UNPKG

1.03 kBTypeScriptView Raw
1import type { Maybe } from '../jsutils/Maybe';
2import type { ObjMap } from '../jsutils/ObjMap';
3import type { ValueNode } from '../language/ast';
4import type { GraphQLInputType } from '../type/definition';
5/**
6 * Produces a JavaScript value given a GraphQL Value AST.
7 *
8 * A GraphQL type must be provided, which will be used to interpret different
9 * GraphQL Value literals.
10 *
11 * Returns `undefined` when the value could not be validly coerced according to
12 * the provided type.
13 *
14 * | GraphQL Value | JSON Value |
15 * | -------------------- | ------------- |
16 * | Input Object | Object |
17 * | List | Array |
18 * | Boolean | Boolean |
19 * | String | String |
20 * | Int / Float | Number |
21 * | Enum Value | Unknown |
22 * | NullValue | null |
23 *
24 */
25export declare function valueFromAST(
26 valueNode: Maybe<ValueNode>,
27 type: GraphQLInputType,
28 variables?: Maybe<ObjMap<unknown>>,
29): unknown;