UNPKG

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