Skip to content

Commit 0f6784f

Browse files
committed
Remove unneeded toString in MockStore
1 parent 4e85a0e commit 0f6784f

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

packages/mock/src/MockStore.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
isEnumType,
1010
isInterfaceType,
1111
isListType,
12-
isNullableType,
12+
isNonNullType,
1313
isObjectType,
1414
isScalarType,
1515
} from 'graphql';
@@ -335,12 +335,9 @@ export class MockStore implements IMockStore {
335335
currentValue: unknown,
336336
onInsertType: (typeName: string, values: { [fieldName: string]: unknown }) => Ref,
337337
): unknown {
338-
const fieldTypeName = fieldType.toString();
339338
if (value === null) {
340-
if (!isNullableType(fieldType)) {
341-
throw new Error(
342-
`should not be null because ${fieldTypeName} is not nullable. Received null.`,
343-
);
339+
if (isNonNullType(fieldType)) {
340+
throw new Error(`should not be null because ${fieldType} is not nullable. Received null.`);
344341
}
345342
return null;
346343
}

0 commit comments

Comments
 (0)