Skip to main content
Latest
File
import Maybe from '../tsutils/Maybe.d.ts';import { Visitor } from '../language/visitor.d.ts';import { ASTNode, ASTKindToNode, FieldNode } from '../language/ast.d.ts';import { GraphQLSchema } from '../type/schema.d.ts';import { GraphQLDirective } from '../type/directives.d.ts';import { GraphQLType, GraphQLInputType, GraphQLOutputType, GraphQLCompositeType, GraphQLField, GraphQLArgument, GraphQLEnumValue,} from '../type/definition.d.ts';
/** * TypeInfo is a utility class which, given a GraphQL schema, can keep track * of the current field and type definitions at any point in a GraphQL document * AST during a recursive descent by calling `enter(node)` and `leave(node)`. */export class TypeInfo { constructor( schema: GraphQLSchema, // NOTE: this experimental optional second parameter is only needed in order // to support non-spec-compliant code bases. You should never need to use it. // It may disappear in the future. getFieldDefFn?: getFieldDef, // Initial type may be provided in rare cases to facilitate traversals // beginning somewhere other than documents. initialType?: GraphQLType, );
getType(): Maybe<GraphQLOutputType>; getParentType(): Maybe<GraphQLCompositeType>; getInputType(): Maybe<GraphQLInputType>; getParentInputType(): Maybe<GraphQLInputType>; getFieldDef(): GraphQLField<any, Maybe<any>>; getDefaultValue(): Maybe<any>; getDirective(): Maybe<GraphQLDirective>; getArgument(): Maybe<GraphQLArgument>; getEnumValue(): Maybe<GraphQLEnumValue>; enter(node: ASTNode): any; leave(node: ASTNode): any;}
type getFieldDef = ( schema: GraphQLSchema, parentType: GraphQLType, fieldNode: FieldNode,) => Maybe<GraphQLField<any, any>>;
/** * Creates a new visitor instance which maintains a provided TypeInfo instance * along with visiting visitor. */export function visitWithTypeInfo( typeInfo: TypeInfo, visitor: Visitor<ASTKindToNode>,): Visitor<ASTKindToNode>;