Skip to content

Commit 66a15d3

Browse files
authored
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.
1 parent 4ab01b7 commit 66a15d3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/base/BaseTwilio.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import RequestClient from "./RequestClient"; /* jshint ignore:line */
22
import { HttpMethod } from "../interfaces"; /* jshint ignore:line */
3+
import { Headers } from "../http/request"; /* jshint ignore:line */
34

45
const os = require("os"); /* jshint ignore:line */
56
const url = require("url"); /* jshint ignore:line */
@@ -143,7 +144,7 @@ namespace Twilio {
143144
const username = opts.username || this.username;
144145
const password = opts.password || this.password;
145146

146-
const headers: any = opts.headers || {};
147+
const headers = opts.headers || {};
147148

148149
const pkgVersion = moduleInfo.version;
149150
const osName = os.platform();

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"compilerOptions": {
33
"target": "es2020",
4+
"lib": ["es2020"],
45
"module": "commonjs",
56
"declaration": true,
67
"esModuleInterop": true,

0 commit comments

Comments
 (0)