Skip to content

Commit 203402f

Browse files
authored
fix: Downlevel type definitions (#410)
The definitions are now made compatible with older versions of typescript adds a build step using downlevel-dts to handle this NODE-2844
1 parent 2df6b42 commit 203402f

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

package-lock.json

+25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"@typescript-eslint/parser": "^3.10.1",
3939
"benchmark": "^2.1.4",
4040
"chai": "^4.2.0",
41+
"downlevel-dts": "^0.7.0",
4142
"eslint": "^7.7.0",
4243
"eslint-config-prettier": "^6.11.0",
4344
"eslint-plugin-prettier": "^3.1.4",
@@ -81,7 +82,7 @@
8182
"test-node": "mocha test/node",
8283
"test-browser": "karma start karma.conf.js",
8384
"build:ts": "tsc",
84-
"build:dts": "npm run build:ts && api-extractor run --typescript-compiler-folder node_modules/typescript --local && rimraf 'lib/**/*.d.ts*'",
85+
"build:dts": "npm run build:ts && api-extractor run --typescript-compiler-folder node_modules/typescript --local && rimraf 'lib/**/*.d.ts*' && downlevel-dts bson.d.ts bson.d.ts",
8586
"build:bundle": "rollup -c rollup.config.js",
8687
"build": "npm run build:dts && npm run build:bundle",
8788
"lint": "eslint -v && eslint --ext '.js,.ts' --max-warnings=0 src test && tsc -v && tsc --noEmit",

src/long.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ export class Long {
291291
/**
292292
* Tests if the specified object is a Long.
293293
*/
294-
static isLong(value: unknown): value is Long {
294+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
295+
static isLong(value: any): value is Long {
295296
return isObjectLike(value) && value['__isLong__'] === true;
296297
}
297298

0 commit comments

Comments
 (0)