UNPKG

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