10

I'm working on a Typescript NodeJS project that uses multiple Google Cloud client libraries. I want to use ES6 imports for these client libraries so I can use Intellisense in VS Code. However, when I use ES6 imports I get the following issues when trying to compile 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. ```

Are there any changes I need to make to my tsconfig to fix this?

Thanks!

7
  • 2
    What version of Typescript are you running ? has mention here, it required typescript 3.8. Maybe you Vscode is configured to an older version. Commented Aug 18, 2020 at 23:19
  • 2
    I believe you need to set "esModuleInterop": true in tsconfig.json Commented Aug 18, 2020 at 23:27
  • I'm running Typescript 3.9.7 and I have the esModuleInterop option set to true in my config Commented Aug 19, 2020 at 13:03
  • @NielsKersic have you manage to fix that? Commented Feb 12, 2021 at 12:12
  • @AntonPegov Never managed to fix it Commented Feb 17, 2021 at 14:36

1 Answer 1

9

If you're seeing this in your GCloud builds the fix in my case was updating Typescript from 3.7.2 to 4.1.3 - from my understanding any version 3.9+ should work fine.

Sign up to request clarification or add additional context in comments.

1 Comment

I have google-gax files in my cloud-functions folder with typescript "version": "3.9.10", but still I am having the same build errors. Any help?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.