question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript transpilation fails

See original GitHub issue

After 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

  1. Install typescript and @google-cloud/pubsub latest
import { PubSub, Topic } from '@google-cloud/pubsub';
console.log(PubSub, Topic);
  1. 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:closed
  • Created a year ago
  • Reactions:2
  • Comments:7

github_iconTop GitHub Comments

2reactions
vuesomedevcommented, May 5, 2022

For a temporal solution, this worked in package.json:

"overrides": {
  "long": "4.0.0"
}
0reactions
feywindcommented, May 6, 2022

Ah right, it was probably related to this: https://github.com/grpc/grpc-node/pull/2110

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found