UNPKG

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