-
Notifications
You must be signed in to change notification settings - Fork 390
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
Optional bigint support #527
Optional bigint support #527
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for picking this up! A few stylistic suggestions -- the rest looks good.
@@ -0,0 +1,3 @@ | |||
# Treat text as lf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this file from the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without it you're relying on windows contributors having git configured to commit LF instead of CRLF which doesn't seem ideal
@@ -45,7 +45,7 @@ export function parse( | |||
return parseLiteral(schema, keyName) | |||
} | |||
|
|||
const types = typesOfSchema(schema) | |||
const types = typesOfSchema(schema, options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const types = typesOfSchema(schema, options) | |
const types = typesOfSchema(schema) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
options needs to be passed in so that the matchers can read the enableBigInt
option
- This change isn't changing any of the existing behavior by default. - When enabled however, it'll generate integers with no 'maximum' property as 'bigint'. Why? While JSON supports big integers in its specification, JavaScript does not by default. Thus, trying to deserialise a large integer into a JavaScript number is doomed to fail. Since relatively recently however, JavaScript (and therefore TypeScript), natively supports a 'bigint' type for numbers (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt), and there exists fixed parsers that can parse numbers into bigint directly.
…outside the safe range for Number
0467afb
to
cb5799a
Compare
Closing out stale PRs. |
Revisiting PR401 to add bigint support.
Hopefully this PR addresses the outstanding comments on the original PR.