From 9110bb00157a8c3508be6f6e6b16ab1c06cca091 Mon Sep 17 00:00:00 2001 From: Conrawl Rogers Date: Tue, 27 Sep 2022 14:11:55 +0000 Subject: [PATCH 1/2] fix: handle undefined namedType --- packages/plugins/typescript/typescript/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } }, From 8f6fc13bf2bac5abce6d45755859da2f1d7dc1cc Mon Sep 17 00:00:00 2001 From: Conrawl Rogers Date: Tue, 27 Sep 2022 14:20:24 +0000 Subject: [PATCH 2/2] chore: add changeset --- .changeset/eighty-trees-confess.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/eighty-trees-confess.md 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