Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protobuf have issue with typescript long : Cannot find name 'Long' #1104

Closed
chloe2018s opened this issue Aug 21, 2018 · 4 comments
Closed

protobuf have issue with typescript long : Cannot find name 'Long' #1104

chloe2018s opened this issue Aug 21, 2018 · 4 comments
Labels

Comments

@chloe2018s
Copy link

I'm new to protobuf. I'm using "protobufjs": "^6.8.8" for generating typescript. And imported this generated file to my component.spec.ts , then got compilation error when run ng serve
[ERROR] target/generated-sources-js/xxx.d.ts(4253,40): error TS2304: Cannot find name 'Long'.

I included the "@types/long": "^4.0.0", "long": "^4.0.0", in my package.json dependencies. Still got the same error.

Please advise. Many thanks

@digitalizARTE
Copy link

digitalizARTE commented Aug 28, 2018

You need to add the following configuration

{ "compilerOptions": { ... "types": [ ..., "Long"] } ... }

in the tsconfig.jsonfile

compilerOptions.types add "Long" to array

@JustinBeckwith
Copy link
Contributor

Greetings! I think we fixed this over in #1166

@orgads
Copy link

orgads commented Mar 8, 2020

Is there a plan to release a new version anytime soon? This bug exists in 6.8.8, and the fix was never released.

@live680g
Copy link

live680g commented Jun 16, 2022

i fixed Cannot find name 'Long' problem in my angular project.

solution steps:

  1. add "@types/long": "^4.0.0", "long": "^4.0.0", in my package.json dependencies
  2. add configuration { "compilerOptions": { ... "types": [ ..., "Long"] } ... } in my tsconfig.app.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants