It's desirable to represent an ID on the server as a bigint instead of a number.
Currently, the ID scalar type supports serializing number to string, but not bigint.
I'd like to see support for serialization of bigint to string similar to number.
I think it would require changing this code
|
if (Number.isInteger(coercedValue)) { |
|
return String(coercedValue); |
|
} |
to
if (Number.isInteger(coercedValue) || typeof coercedValue == "bigint") {
return String(coercedValue);
}
It's desirable to represent an ID on the server as a
bigintinstead of anumber.Currently, the ID scalar type supports serializing
numbertostring, but notbigint.I'd like to see support for serialization of
biginttostringsimilar tonumber.I think it would require changing this code
graphql-js/src/type/scalars.ts
Lines 225 to 227 in d766c8e