Skip to content

Commit

Permalink
fix: use correct Headers type (#925)
Browse files Browse the repository at this point in the history
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.

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.
  • Loading branch information
Methuselah96 committed Mar 16, 2023
1 parent 4ab01b7 commit 66a15d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/base/BaseTwilio.ts
@@ -1,5 +1,6 @@
import RequestClient from "./RequestClient"; /* jshint ignore:line */
import { HttpMethod } from "../interfaces"; /* jshint ignore:line */
import { Headers } from "../http/request"; /* jshint ignore:line */

const os = require("os"); /* jshint ignore:line */
const url = require("url"); /* jshint ignore:line */
Expand Down Expand Up @@ -143,7 +144,7 @@ namespace Twilio {
const username = opts.username || this.username;
const password = opts.password || this.password;

const headers: any = opts.headers || {};
const headers = opts.headers || {};

const pkgVersion = moduleInfo.version;
const osName = os.platform();
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"target": "es2020",
"lib": ["es2020"],
"module": "commonjs",
"declaration": true,
"esModuleInterop": true,
Expand Down

0 comments on commit 66a15d3

Please sign in to comment.