import { TypeNode , NamedTypeNode , } from 'graphql' ; import { LIST_TYPE , NON_NULL_TYPE , } from 'graphql/language/kinds' ; export function getNamedTypeNode ( typeNode ) { let namedType = typeNode ; while ( namedType . kind === LIST_TYPE || namedType . kind === NON_NULL_TYPE ) { namedType = namedType . type ; } return namedType ; }