diff --git a/.changeset/eighty-trees-confess.md b/.changeset/eighty-trees-confess.md new file mode 100644 index 00000000000..1ced43cffcb --- /dev/null +++ b/.changeset/eighty-trees-confess.md @@ -0,0 +1,5 @@ +--- +'@graphql-codegen/typescript': major +--- + +handle undefined namedType when including introspection type definitions diff --git a/packages/plugins/typescript/typescript/src/index.ts b/packages/plugins/typescript/typescript/src/index.ts index 2baf4ac887f..342bc3308cf 100644 --- a/packages/plugins/typescript/typescript/src/index.ts +++ b/packages/plugins/typescript/typescript/src/index.ts @@ -65,7 +65,7 @@ export function includeIntrospectionTypesDefinitions( Field() { const type = getNamedType(typeInfo.getType()); - if (isIntrospectionType(type) && !usedTypes.includes(type)) { + if (type && isIntrospectionType(type) && !usedTypes.includes(type)) { usedTypes.push(type); } },