From d87978b8eb2a176676c58379a89206b94a6d926a Mon Sep 17 00:00:00 2001 From: James Bromwell <943160+thw0rted@users.noreply.github.com> Date: Wed, 17 Aug 2022 21:04:05 +0200 Subject: [PATCH] fix(types): update type deps (#1776) * Update type deps Remove duplicate `long` types * Fix type tests Co-authored-by: Alexander Fenster --- cli/pbts.js | 2 +- index.d.ts | 2 +- tests/README.md | 2 +- tests/data/mapbox/vector_tile.d.ts | 2 ++ tsconfig.json | 3 ++- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cli/pbts.js b/cli/pbts.js index dd7273278..e1e003760 100644 --- a/cli/pbts.js +++ b/cli/pbts.js @@ -144,7 +144,7 @@ exports.main = function(args, callback) { var output = []; if (argv.main) output.push( - "// DO NOT EDIT! This is a generated file. Edit the JSDoc in src/*.js instead and run 'npm run types'.", + "// DO NOT EDIT! This is a generated file. Edit the JSDoc in src/*.js instead and run 'npm run build:types'.", "" ); if (argv.global) diff --git a/index.d.ts b/index.d.ts index be394f08f..3bcc2d250 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,4 +1,4 @@ -// DO NOT EDIT! This is a generated file. Edit the JSDoc in src/*.js instead and run 'npm run types'. +// DO NOT EDIT! This is a generated file. Edit the JSDoc in src/*.js instead and run 'npm run build:types'. export as namespace protobuf; diff --git a/tests/README.md b/tests/README.md index 783e6c6d7..b9e2eff73 100644 --- a/tests/README.md +++ b/tests/README.md @@ -5,7 +5,7 @@ It is essential that tests only use the cross-platform API that is also availabl * Use `load`, not `loadSync` * Use `Reader.create`, not `BufferReader` * Use `Writer.create`, not `BufferWriter` -* It is safe to use `Long` +* It is safe to use `Long`, but TypeScript tests must import the type from `"long"` If it's absolutely inevitable for your test case to use node-specific features, you can still use this pattern: diff --git a/tests/data/mapbox/vector_tile.d.ts b/tests/data/mapbox/vector_tile.d.ts index 382277350..c11da0697 100644 --- a/tests/data/mapbox/vector_tile.d.ts +++ b/tests/data/mapbox/vector_tile.d.ts @@ -1,4 +1,6 @@ import * as $protobuf from "../../.."; +import Long from "long"; + export namespace vector_tile { interface ITile { diff --git a/tsconfig.json b/tsconfig.json index 22852fa67..a0b3639c2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "target": "ES5", "experimentalDecorators": true, - "emitDecoratorMetadata": true + "emitDecoratorMetadata": true, + "esModuleInterop": true, } } \ No newline at end of file