Skip serialization for empty or string bigint values in GraphQL (#16297)

This commit is contained in:
ian
2022-11-03 18:37:56 +08:00
committed by GitHub
parent d78ccf5898
commit 64bffa60e9

View File

@@ -4,6 +4,8 @@ export const GraphQLBigInt = new GraphQLScalarType({
name: 'GraphQLBigInt',
description: 'BigInt value',
serialize(value) {
if (!value) return value;
if (typeof value === 'string') return value;
if (typeof value !== 'number') {
throw new Error('Value must be a Number');
}