-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Export GRAPHQL_MAX_INT and GRAPHQL_MIN_INT #3355
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.
Please export it in src/type/index.ts
and src/index.ts
.
Also please check tests folder for the places where this number (or +-1) is used and replace them with this constant.
Hello @IvanGoncharov , thank you for bringing these up and your detailed comment.
$ grep -R "214748364" src # Intentionally missing the last character
src/type/scalars.ts:export const GRAPHQL_MAX_INT = 2147483647;
src/type/scalars.ts:export const GRAPHQL_MIN_INT = -2147483648;
$ grep -R "2^31" src
src/type/scalars.ts: 'The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.',
$ grep -R "2 \*\* 31" src
# no results
*Were you also suggesting that tests to these boundaries should be changed? expect(() => parseLiteral('-9876504321')).to.throw(
'Int cannot represent non 32-bit signed integer value: -9876504321',
); Would now be expect(() => parseLiteral(GRAPHQL_MIN_INT-1)).to.throw(
`Int cannot represent non 32-bit signed integer value: ${GRAPHQL_MIN_INT-1}`,
); Should I make this change? Thank you. |
Matching the order from type/index.ts
@IvanGoncharov @saihaj thank you. |
@IvanGoncharov I don't think we will be able to merge until you re-review. |
@tofran Thanks 👍 |
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.
Just to avoid noise from potential bot accounts. |
Closes #2524
(Replaces abandoned #2582)