Typescript transpilation fails
See original GitHub issueAfter upgrading the library from 2.19.0
to 2.19.3
the Typescript transpilation started to fail with the following error message
node_modules/@google-cloud/pubsub/build/protos/protos.d.ts:15:23 - error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export.
15 import * as Long from "long";
~~~~~~
node_modules/google-gax/build/protos/iam_service.d.ts:17:23 - error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export.
17 import * as Long from 'long';
~~~~~~
node_modules/google-gax/build/protos/operations.d.ts:17:23 - error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export.
17 import * as Long from 'long';
~~~~~~
Found 3 errors in 3 files.
Environment details
- OS: macOS Monterey 12.3.1
- Node.js version: 14.17.4
- npm version: 6.14.14
@google-cloud/pubsub
version: 2.19.3
Steps to reproduce
- Install
typescript
and@google-cloud/pubsub
latest
import { PubSub, Topic } from '@google-cloud/pubsub';
console.log(PubSub, Topic);
- Transpile the above code with latest Typescript
Created an example repository, just have to clone, install and run npm run build
.
Setting the flag esModuleInterop
to true
doesn’t solve the issue.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:7
Top Results From Across the Web
VM1052:19 Error: (SystemJS) TypeScript transpilation failed
I am new to angular, I am trying to change color for each li when I click it. but I am getting an...
Read more >Controlling transpilation - Learn TypeScript
There is a compilation option called noEmit to stop transpilation all together. This is useful when we are using Babel in a project....
Read more >TSConfig Reference - Docs on every TSConfig option
When this option is set, TypeScript will issue an error if a program tries to include a file by a casing different from...
Read more >TypeScript configuration - Angular
Typescript must be "transpiled" into JavaScript using the tsc compiler, ... it still generates the JavaScript files, but it also reports an error....
Read more >Typescript — How to solve the problem with unresolved path ...
This error actually points to the transpiled('emitted') JavaScript .js file containing the line with the path alias. The actual cause of the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For a temporal solution, this worked in
package.json
:Ah right, it was probably related to this: https://github.com/grpc/grpc-node/pull/2110