Improve typing for typescript-with-node serverless function example
eliasm307 opened this issue · 0 comments
eliasm307 commented
This example can be improved by applying the types defined in @scaleway/serverless-functions
e.g.
import type { Handler } from "@scaleway/serverless-functions/framework/types/types";
export const handle: Handler = async (event, context, cb) => {
return {
body: "Hello world!",
headers: { "Content-Type": ["application/json"] },
statusCode: 200,
};
};
The types from @scaleway/serverless-functions/framework/types/types
could also be exposed at the package entry point so it can be simplified to:
import type { Handler } from "@scaleway/serverless-functions";
export const handle: Handler = async (event, context, cb) => {
return {
body: "Hello world!",
headers: { "Content-Type": ["application/json"] },
statusCode: 200,
};
};