diff --git a/packages/graphqlgen/src/generators/common.ts b/packages/graphqlgen/src/generators/common.ts index 8d3c0edc..50d2ff26 100644 --- a/packages/graphqlgen/src/generators/common.ts +++ b/packages/graphqlgen/src/generators/common.ts @@ -41,10 +41,10 @@ export function fieldsFromModelDefinition( // If model is of type `type TypeName = { ... }` if ( modelDef.kind === 'TypeAliasDefinition' && - (modelDef as TypeAliasDefinition).getType().kind === - 'AnonymousInterfaceAnnotation' + modelDef.getType() && + modelDef.getType().kind === 'AnonymousInterfaceAnnotation' ) { - const interfaceDef = (modelDef as TypeAliasDefinition).getType() as AnonymousInterfaceAnnotation + const interfaceDef = modelDef.getType() as AnonymousInterfaceAnnotation return interfaceDef.fields }