我正在使用多个Google Cloud客户端库的Typescript NodeJS项目。
我想将ES6导入用于这些客户端库,以便可以在VS Code中使用Intellisense。
但是,当我使用ES6导入时,尝试编译Typescript时出现以下问题:
TS1005: 'from' expected. 119 export * as protobufMinimal from 'protobufjs/minimal'; ~~ node_modules/google-gax/build/src/fallback.d.ts:119:13 - error TS1005: ';' expected. 119 export * as protobufMinimal from 'protobufjs/minimal'; ~~~~~~~~~~~~~~~ node_modules/google-gax/build/src/fallback.d.ts:119:29 - error TS1005: ';' expected. 119 export * as protobufMinimal from 'protobufjs/minimal'; ~~~~ node_modules/google-gax/build/src/fallback.d.ts:119:34 - error TS1005: ';' expected. 119 export * as protobufMinimal from 'protobufjs/minimal'; ~~~~~~~~~~~~~~~~~~~~ node_modules/google-gax/build/src/index.d.ts:47:10 - error TS1005: 'from' expected. 47 export * as protobufMinimal from 'protobufjs/minimal'; ~~ node_modules/google-gax/build/src/index.d.ts:47:13 - error TS1005: ';' expected. 47 export * as protobufMinimal from 'protobufjs/minimal'; ~~~~~~~~~~~~~~~ node_modules/google-gax/build/src/index.d.ts:47:29 - error TS1005: ';' expected. 47 export * as protobufMinimal from 'protobufjs/minimal'; ~~~~ node_modules/google-gax/build/src/index.d.ts:47:34 - error TS1005: ';' expected. 47 export * as protobufMinimal from 'protobufjs/minimal'; ~~~~~~~~~~~~~~~~~~~~ Found 8 errors. ```
我需要对
tsconfig
进行任何更改以解决此问题吗?谢谢!
最佳答案
如果您在GCloud构建中看到此问题,那么在我的案例中,此修复程序是将Typescript从3.7.2更新到4.1.3-从我的理解来看,任何3.9+版本都可以正常工作。
关于node.js - 使用 "export * as"语法的node_modules软件包中的 typescript 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63477857/