I'm trying out my first Cloud Function following this guide (https://www.youtube.com/watch?v=qZ1EFnFOGvE&list=PL55RiY5tL51r5jyQoPZhwLueLpPeAV6P9) which is written in JS, but instead writing in Typescript.
I have created the following:
// // Start writing Firebase Functions
// // https://firebase.google.com/docs/functions/typescript
//
export const helloWorld = functions.https.onRequest((request, response) => {
if (request.method !== 'POST') {
return response.status(500).json({
message: 'Not allowed'
});
}
response.status(200).json({
message: 'Hello World!'
});
});
However, the linter gives me the following error:
Argument of type '(request: Request, response: Response) => Response | undefined' is not assignable to parameter of type '(req: Request, resp: Response) => void | Promise'. Type 'Response | undefined' is not assignable to type 'void | Promise'. Type 'Response' is not assignable to type 'void | Promise'. Type 'Response' is missing the following properties from type 'Promise': then, catch, [Symbol.toStringTag]
I am unsure how to amend the code.