You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue has been reported multiple times in #1104#1071#940 but were all closed with #1166. However that PR was reverted and never made it into a release. As of today, it seems like any definition file generated by pbts that references a Long type is invalid.
The text was updated successfully, but these errors were encountered:
I've run into the same issue. I was able to figure out the root cause was that I had a dependency on a library which had a types.d.ts file generated using pbts and used protobufjs v6.11.2. But my package has a dependency on protobufjs v7.2.2.
In v7 of protobufjs, they removed @types/long and instead use long directly. However, this requires a import Long from 'long' in the generated types.d.ts file. (See the fix in v7 here). Therefore if you import a type.d.ts file without this import (which is missing on older protobufjs version generated files), then the resolution of Long fails (if using v7 protobufjs).
Your options are:
Re-generate the typescript types with the version of protobufjs (or protobufjs-cli) that matches the runtime protobufjs version you are using.
Downgrade your runtime dependency on protobufjs to match the version used to generate the type definitions.
Add @types/long: "^4.0.1" to your package.json devDependencies section.
I went with option 3, since I depend on a handful of pbts generate packages (some on v6, others using v7) which I needed to migrate to v7 iteratively.
protobuf.js version: 6.10.2
This issue has been reported multiple times in #1104 #1071 #940 but were all closed with #1166. However that PR was reverted and never made it into a release. As of today, it seems like any definition file generated by
pbts
that references aLong
type is invalid.The text was updated successfully, but these errors were encountered: