twilio / twilio-cli

Unleash the power of Twilio from your command prompt
MIT License
162 stars 79 forks source link

fresh twilio-cli installation, and trying to create a typescript project has type errors #611

Open Haiz14 opened 2 days ago

Haiz14 commented 2 days ago

Issue Summary

installed a new twilio-cli via apt keyring twilio --version twilio-cli/5.22.3 wsl-x64 node-v18.20.4 but a new project created with it twilio serverless:init teste --typescript has type issues.

 ~/teste> npm run start

> teste@0.0.0 prestart
> npm run build

> teste@0.0.0 build
> tsc && npm run build:copy-assets

src/functions/hello-world.ts:21:14 - error TS2322: Type '(context: Context<MyContext>, event: MyEvent, callback: ServerlessCallback) => void' is not assignable to type 'ServerlessFunctionSignature'.
  Types of parameters 'event' and 'event' are incompatible.
    Type '{ request: { cookies: {}; headers: {}; }; }' has no properties in common with type 'MyEvent'.

21 export const handler: ServerlessFunctionSignature = function(
                ~~~~~~~

Found 1 error in src/functions/hello-world.ts:21

Steps to Reproduce

  1. install twilio-cli via apt
  2. run twilio serverless:init teste --t typescript a prompt to download serverless plugin will occur
  3. run above command again
  4. cd teste && npm run start

Technical details:

Haiz14 commented 2 days ago

the problem is not that i can't fix it. but fresh installations should work, right?

Haiz14 commented 2 days ago

the twilio-runtime version set as default in package.json via twilio serverless:init teste --typescript is 2.0.3. while available via npm. but not available in twilio-serverlessenvironment.

the latest available dependency seems to be 2.0.1 according to docs https://www.twilio.com/docs/serverless/functions-assets/handler