UNPKG

801 BTypeScriptView Raw
1import Maybe from '../tsutils/Maybe';
2import { ValueNode } from '../language/ast';
3import { GraphQLInputType } from '../type/definition';
4
5/**
6 * Produces a GraphQL Value AST given a JavaScript value.
7 *
8 * A GraphQL type must be provided, which will be used to interpret different
9 * JavaScript values.
10 *
11 * | JSON Value | GraphQL Value |
12 * | ------------- | -------------------- |
13 * | Object | Input Object |
14 * | Array | List |
15 * | Boolean | Boolean |
16 * | String | String / Enum Value |
17 * | Number | Int / Float |
18 * | Mixed | Enum Value |
19 * | null | NullValue |
20 *
21 */
22export function astFromValue(
23 value: any,
24 type: GraphQLInputType,
25): Maybe<ValueNode>;