twilio / twilio-node

Node.js helper library
MIT License
1.37k stars 497 forks source link

Build error regarding "Headers" name not found when using this sdk. #923

Closed quldude closed 1 year ago

quldude commented 1 year ago

Issue Summary

Getting an error when building a nodejs app using twilio sdk.

Steps to Reproduce

  1. Use "twilio": "^4.8.0"
  2. run build command tsc -p tsconfig.build.json

Exception/Log

node_modules/twilio/lib/base/BaseTwilio.d.ts:22:19 - error TS2304: Cannot find name 'Headers'.

22         headers?: Headers;
                     ~~~~~~~

Found 1 error in node_modules/twilio/lib/base/BaseTwilio.d.ts:22

Technical details:

quldude commented 1 year ago

resolved this by adding DOM in tsconfig.

ehaynes99 commented 1 year ago

This should not be closed. Node projects should not include the DOM types. There is no window, document, etc. so you're opening up a whole class of runtime errors that should be compile errors. The twilio client should mimic the type and export it with the client.

childish-sambino commented 1 year ago

👀 on https://github.com/twilio/twilio-node/pull/925 which should fix this ...

childish-sambino commented 1 year ago

Fixed by #925