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

'Long' only refers to a type, but is being used as a namespace here. #41

Closed
rixhy-cyd opened this issue Oct 11, 2022 · 11 comments
Closed

Comments

@rixhy-cyd
Copy link

Screenshot 2022-10-11 at 2 04 07 PM

getting this error in all the places where Long is used in side the directory
node_modules/cosmjs-types/tendermint

@rixhy-cyd
Copy link
Author

@webmaster128 Can you help me with this

@webmaster128
Copy link
Member

webmaster128 commented Oct 11, 2022

Do you have long or @types/long installed in your project? We use both in version 4 (not version 5!) and this seems to work.

@rixhy-cyd
Copy link
Author

Actually I installed osmojs, which has cosmjs/proto-signing as dependency and which inturn has dependency for cosmjs-types

@rixhy-cyd
Copy link
Author

an example error :

node_modules/cosmjs-types/cosmos/tx/signing/v1beta1/signing.d.ts:113:42 - error TS2702: 'Long' only refers to a type, but is being used as a namespace here.

113 sequence?: string | number | Long.Long | undef

@webmaster128
Copy link
Member

@types/long makes this a namespace. So I guess there is something wrong with the dependency.

@pyramation do you have an idea what could be wrong with osmojs? Are you maintaining that?

@pyramation
Copy link
Contributor

pyramation commented Oct 11, 2022

we had a similar issue in osmojs but used import * as Long from 'long' which solved the issue. When the typescript compiler started to error out from cosmjs-types, I didn't know how to fix that as it is a dependency. However, it could end up getting fixed after #40 with the same fix I just deployed.

The issue I believe has to do with the way ts-proto is generating import Long from 'long'

@rixhy-cyd
Copy link
Author

@webmaster128 @pyramation What should i do now ?

@pyramation
Copy link
Contributor

pyramation commented Oct 11, 2022

@webmaster128 @pyramation What should i do now ?

I think you should leverage ts-ignore somewhere in your project. We're working to remove ts-proto from cosmjs but will take some time.

@rixhy-cyd
Copy link
Author

Thanks @pyramation @webmaster128 looking forward for the cosmjs update soon

@rixhy-cyd
Copy link
Author

Thanks, @pyramation @webmaster128 looking forward for the cosm-js update soon

@webmaster128
Copy link
Member

The latest release cosmjs-types 0.9.0 gets rid of long entirely. All 64 bit integers types use bigint now.

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

No branches or pull requests

3 participants