-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 issue #921
Comments
If it returns a number instead of a Long, this implies that long.js hasn't been loaded properly. See also |
The following is part of my package.json "dependencies": {
"long": "^3.2.0",
"protobufjs": "~6.8.0"
} Is there additional steps for installing long.js ? import Long from 'long';
consloe.log(Long.ZERO); |
@dcodeIO , What is wrong here? |
Try: var Long = ...;
protobuf.util.Long = Long;
protobuf.configure(); |
Fixed |
If you are using angular, you can insert these code to main.ts. import * as protobuf from 'protobufjs/minimal';
import * as Long from 'long';
if (environment.production) {
enableProdMode();
}
protobuf.util.Long = Long;
protobuf.configure(); It works fine for me. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
protobuf.js version: <6.8.0>
In the following code I use
--force-long
and MyProto.id isuint64
fieldIn generated code , in comments every thing is ok and type is
Long
but when you logid
it is number not long (Please see generated code too)myproto.proto
bundle.js
In the
MyProto.decode
you can seemessage.id = reader.uint64();
, I think it must beLong
, may be not , but if you decode a serialized buffer andconsole.log(myProto.id)
; it isnumber
notLong
The text was updated successfully, but these errors were encountered: