From 66a15d301c828733317a2a09f9d77b8b7634d5a5 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Thu, 16 Mar 2023 11:29:08 -0400 Subject: [PATCH] fix: use correct Headers type (#925) 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. --- src/base/BaseTwilio.ts | 3 ++- tsconfig.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/base/BaseTwilio.ts b/src/base/BaseTwilio.ts index 7c8d900543..05c0f02d6d 100644 --- a/src/base/BaseTwilio.ts +++ b/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 */ @@ -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(); diff --git a/tsconfig.json b/tsconfig.json index a99ed63d38..3e0fc0a952 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "target": "es2020", + "lib": ["es2020"], "module": "commonjs", "declaration": true, "esModuleInterop": true,