UNPKG

1.15 kBTypeScriptView Raw
1import type {
2 ListTypeNode,
3 NamedTypeNode,
4 NonNullTypeNode,
5 TypeNode,
6} from '../language/ast';
7import type { GraphQLNamedType, GraphQLType } from '../type/definition';
8import { GraphQLList, GraphQLNonNull } from '../type/definition';
9import type { GraphQLSchema } from '../type/schema';
10/**
11 * Given a Schema and an AST node describing a type, return a GraphQLType
12 * definition which applies to that type. For example, if provided the parsed
13 * AST node for `[User]`, a GraphQLList instance will be returned, containing
14 * the type called "User" found in the schema. If a type called "User" is not
15 * found in the schema, then undefined will be returned.
16 */
17export declare function typeFromAST(
18 schema: GraphQLSchema,
19 typeNode: NamedTypeNode,
20): GraphQLNamedType | undefined;
21export declare function typeFromAST(
22 schema: GraphQLSchema,
23 typeNode: ListTypeNode,
24): GraphQLList<any> | undefined;
25export declare function typeFromAST(
26 schema: GraphQLSchema,
27 typeNode: NonNullTypeNode,
28): GraphQLNonNull<any> | undefined;
29export declare function typeFromAST(
30 schema: GraphQLSchema,
31 typeNode: TypeNode,
32): GraphQLType | undefined;