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

Adding this library to a typescript project causes compilations error: TS2304: Cannot find name 'Long' #604

Closed
gae123 opened this issue Oct 10, 2019 · 4 comments · Fixed by #640
Assignees
Labels
api: logging Issues related to the googleapis/nodejs-logging API. needs more info This issue needs more information from the customer to proceed. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. TypeScript

Comments

@gae123
Copy link

gae123 commented Oct 10, 2019

Steps to reproduce:

  1. Create a small typescript project that compiles and works
  2. In package.json add "@google-cloud/logging": "5.4.1"
  3. Import with import * as googleLogging from '@google-cloud/logging';
  4. Compile again, you will now see errors about missing Long

WORKAROUND

I did what I describe here to work around this issue, but this should not be required or at least should be documented.

Environment

$ tsc --version
Version 3.5.3
$ node --version
v10.16.2
@gae123 gae123 changed the title Adding this library to a typescript project generates errors about Long Adding this library to a typescript project causes compilations error: TS2304: Cannot find name 'Long' Oct 10, 2019
@callmehiphop callmehiphop added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. TypeScript labels Oct 10, 2019
@JustinBeckwith
Copy link
Contributor

Greetings folks! I'm having a little trouble reproducing this one. Here is the example I'm working from:
https://github.com/JustinBeckwith/ts2304

Could I ask you to:

  • Try the latest version of TypeScript (3.7.2 as of now)
  • Try the latest version of @google-cloud/logging (5.5.4 as of now)
  • Try running rm -rf node_modules package-lock.json, and running npm install again.

I suspect some older versions of protobufjs are getting cached, as I think we fixed this way back here:
protobufjs/protobuf.js#1166

@JustinBeckwith JustinBeckwith added the needs more info This issue needs more information from the customer to proceed. label Nov 8, 2019
@fallard84
Copy link

I have the same issue. The fix protobufjs/protobuf.js#1166 is still not released.

@bcoe
Copy link
Contributor

bcoe commented Nov 15, 2019

@alexander-fenster I noticed we'd landed the long type in gax, does this address the issue in this thread?

@alexander-fenster
Copy link
Contributor

@bcoe No, because this project has its own hand crafted .d.ts files. I'm fixing it in a separate PR (linked above).

@google-cloud-label-sync google-cloud-label-sync bot added the api: logging Issues related to the googleapis/nodejs-logging API. label Jan 31, 2020
@JustinBeckwith JustinBeckwith self-assigned this Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/nodejs-logging API. needs more info This issue needs more information from the customer to proceed. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants