Skip to content

Commit 0d73e69

Browse files
committed
Fix BigInt handling
1 parent 5b66cd5 commit 0d73e69

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/tender-spoons-burn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'graphql-scalars': patch
3+
---
4+
5+
Fix BigInt handling

src/scalars/BigInt.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export const GraphQLBigIntConfig: GraphQLScalarTypeConfig<
8080
if (inputValue.toString() !== bigint.toString()) {
8181
throw createGraphQLError(`BigInt cannot represent value: ${inputValue}`);
8282
}
83-
if (!isSafeInteger(bigint) && !isBigIntSerializable()) {
83+
if (isSafeInteger(bigint) && !isBigIntSerializable()) {
8484
return Number(bigint.toString());
8585
}
8686
return bigint;
@@ -96,7 +96,7 @@ export const GraphQLBigIntConfig: GraphQLScalarTypeConfig<
9696
if (strOrBooleanValue.toString() !== bigint.toString()) {
9797
throw createGraphQLError(`BigInt cannot represent value: ${strOrBooleanValue}`);
9898
}
99-
if (!isSafeInteger(bigint) && !isBigIntSerializable()) {
99+
if (isSafeInteger(bigint) && !isBigIntSerializable()) {
100100
return Number(bigint.toString());
101101
}
102102
return bigint;

0 commit comments

Comments
 (0)