From ef43cdfc859ef6aeec88ae8fa2d1624c72817454 Mon Sep 17 00:00:00 2001 From: Gabin Desserprit Date: Tue, 4 Dec 2018 15:17:14 +0200 Subject: [PATCH] Fix #6: Error: Cannot read property 'name' of null --- src/GenerateFragments.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GenerateFragments.ts b/src/GenerateFragments.ts index 6986026..eef6a1b 100755 --- a/src/GenerateFragments.ts +++ b/src/GenerateFragments.ts @@ -192,7 +192,7 @@ export class GenerateFragments { (ast.getType(typeName) as GraphQLNamedType).constructor.name === "GraphQLObjectType" ) .filter(typeName => !typeName.startsWith("__")) - .filter(typeName => typeName !== (ast.getQueryType() as GraphQLObjectType).name) + .filter(typeName => ast.getQueryType() ? typeName !== (ast.getQueryType() as GraphQLObjectType).name : true) .filter( typeName => ast.getMutationType()