Skip to content

Commit

Permalink
Update config to support ES6 classes.
Browse files Browse the repository at this point in the history
Targeting ES5 causes the "fixes issue #145" test in cookieJar.spec.ts
to fail. Changing the target to the next newest (ES6) requires adding
"moduleResolution" to the tsconfig, which then causes issues with using
`import` in our TypeScript, but `require` in the legacy vows tests. To
support both, we have to bump to a newer version of TypeScript to use
the new "node16" module/moduleResolution. (Note: I didn't jump to the
_latest_ TypeScript to try to support older projects, as well.)
  • Loading branch information
wjhsf committed Mar 18, 2023
1 parent 069a7ee commit 34b968c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
9 changes: 1 addition & 8 deletions lib/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,4 @@ export function validate(bool: boolean, cb?: any, options?: any): void {
}
}

export class ParameterError extends Error {
constructor(...params: any[]) {
super(...params);
if (Object.setPrototypeOf) {
Object.setPrototypeOf(this, ParameterError.prototype);
}
}
}
export class ParameterError extends Error {}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@
"format": "npm run eslint -- --fix"
},
"engines": {
"node": ">=6"
"node": ">=16"
},
"devDependencies": {
"@types/jest": "^27.4.0",
"@types/punycode": "^2.1.0",
"@types/psl": "^1.1.0",
"@types/punycode": "^2.1.0",
"async": "^2.6.2",
"eslint": "^5.16.0",
"eslint-config-prettier": "^4.2.0",
Expand All @@ -105,7 +105,7 @@
"nyc": "^14.0.0",
"prettier": "^1.17.0",
"ts-jest": "^27.1.3",
"typescript": "4.5.5",
"typescript": "4.7.4",
"vows": "^0.8.2"
},
"dependencies": {
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"experimentalDecorators": true,
"outDir": "./dist",
"allowJs": true,
"target": "es5",
"target": "ES2016",
"moduleResolution": "node16",
"module": "Node16",
"resolveJsonModule": true,
"esModuleInterop": true,
"strict": true,
Expand Down

0 comments on commit 34b968c

Please sign in to comment.