diff --git a/.changeset/sour-impalas-sing.md b/.changeset/sour-impalas-sing.md new file mode 100644 index 00000000..ef8a72b1 --- /dev/null +++ b/.changeset/sour-impalas-sing.md @@ -0,0 +1,5 @@ +--- +'create-twilio-function': minor +--- + +fix hello-world template diff --git a/packages/create-twilio-function/templates/typescript/src/functions/hello-world.ts b/packages/create-twilio-function/templates/typescript/src/functions/hello-world.ts index b06ce621..8e0b6f44 100644 --- a/packages/create-twilio-function/templates/typescript/src/functions/hello-world.ts +++ b/packages/create-twilio-function/templates/typescript/src/functions/hello-world.ts @@ -5,25 +5,30 @@ import { Context, ServerlessCallback, ServerlessFunctionSignature, + ServerlessEventObject, } from '@twilio-labs/serverless-runtime-types/types'; type MyEvent = { - Body?: string -} + Body?: string; +}; // If you want to use environment variables, you will need to type them like // this and add them to the Context in the function signature as // Context as you see below. type MyContext = { - GREETING?: string -} + GREETING?: string; +}; -export const handler: ServerlessFunctionSignature = function( +export const handler: ServerlessFunctionSignature = function ( context: Context, - event: MyEvent, + event: ServerlessEventObject, callback: ServerlessCallback ) { const twiml = new Twilio.twiml.VoiceResponse(); - twiml.say(`${context.GREETING ? context.GREETING : 'Hello'} ${event.Body ? event.Body : 'World'}!`); + twiml.say( + `${context.GREETING ? context.GREETING : 'Hello'} ${ + event.Body ? event.Body : 'World' + }!` + ); callback(null, twiml); -}; \ No newline at end of file +};