twilio / twilio-node

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

fix: use correct Headers type #925

Closed Methuselah96 closed 1 year ago

Methuselah96 commented 1 year ago

Fixes

The RequestOpts interface was incorrectly using the Headers type from the DOM lib. This produces an error for TypeScript users if they have skipLibCheck set to false and are not including the DOM TypeScript lib:

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

This PR also updates the lib in tsconfig.json to match the target. This makes it so that the DOM TypeScript lib is not included, since by default the DOM lib is included unless specified otherwise. I verified that this change would have caught this issue.

Checklist

If you have questions, please file a support ticket, or create a GitHub Issue in this repository.