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

feat: Allow i64 to be represented as string in user code #148

Merged
merged 1 commit into from
Mar 11, 2019

Conversation

kevin-greene-ck
Copy link
Contributor

@kevin-greene-ck kevin-greene-ck commented Mar 7, 2019

This PR changes the "loose" representation of i64 to be number | string | thrift.Int64. Previously this was number | thrift.Int64.

Because we can't confidently represent the full range of 64-bit integers in the JavaScript number type (we'll explore bigint in the future) we have to use a wrapper type Int64 to maintain precision. Values that are generated in JS are very unlikely to actually need the full precision and can therefore be represented as number in user code. Another work around for users is to pass 64-bit integers as string. In the generated code we can handle these conversions for the user and allow them to represent these numbers as makes sense to their app.

Copy link
Contributor

@ramakrishna-battala-ck ramakrishna-battala-ck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kevin-greene-ck kevin-greene-ck merged commit 0831ec6 into master Mar 11, 2019
@kevin-greene-ck kevin-greene-ck deleted the i64-string branch April 8, 2019 16:49
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

Successfully merging this pull request may close these issues.

2 participants