Skip to content

Commit 045c81c

Browse files
committed
codegen: Check for ValueKind.NULL in getters
1 parent 2d553ef commit 045c81c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/codegen/schema.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,8 @@ module.exports = class SchemaCodeGenerator {
125125
let fieldValueType = this._valueTypeFromGraphQl(gqlType)
126126
let returnType = this._typeFromGraphQl(gqlType)
127127

128-
129128
let getNonNullable = `return ${typesCodegen.valueToAsc('value', fieldValueType)}`
130-
let getNullable = `if (value === null) {
129+
let getNullable = `if (value === null || value.kind == ValueKind.NULL) {
131130
return null
132131
} else {
133132
${getNonNullable}

0 commit comments

Comments
 (0)