-
Notifications
You must be signed in to change notification settings - Fork 72
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
[JS] toString on proto.google.protobuf.Int64Value doesn't return the correct value on large numbers #74
Comments
Tried using the js_type field option, but that doesn't work on wrapper types because that option is undefined on wrappers. ( It also doesn't work on unwrapped types due to a missing setProto3StringIntField function on Message. ) . |
js_type is definitely the right answer, which is why I opened protocolbuffers/protobuf#4025. I also submitted protocolbuffers/protobuf#4332 to address the missing function. Waiting on a response. |
I am working on releasing setProto3StringIntField to opensource. |
Thanks for the update @TeBoring.
I wanted to confirm that this is my understanding as well and I use that field annotation throughout my protos. |
Yes, if you want to avoid data loss you should use JS_STRING. |
Hi @TeBoring, Please, is there any update on this? I also get that Thanks |
@TeBoring it seems like a fix is to add |
Any update to this issue regarding the wrappers, sounds like @nickpresta's suggested solution is easy to implement? |
Create a proto.google.protobuf.Int64Value with the value 9223372036854775807
Call toString on it. You'll get back 9223372036854776000
I'm sure it's converting it to a JS Number then converting it to a string, which is exactly what I don't want it to do.
I'm also interested in any workarounds.
The text was updated successfully, but these errors were encountered: