UNPKG

978 BTypeScriptView Raw
1import { GraphQLInputType, ValueNode } from 'graphql';
2import { Maybe } from './types.js';
3/**
4 * Produces a GraphQL Value AST given a JavaScript object.
5 * Function will match JavaScript/JSON values to GraphQL AST schema format
6 * by using suggested GraphQLInputType. For example:
7 *
8 * astFromValue("value", GraphQLString)
9 *
10 * A GraphQL type must be provided, which will be used to interpret different
11 * JavaScript values.
12 *
13 * | JSON Value | GraphQL Value |
14 * | ------------- | -------------------- |
15 * | Object | Input Object |
16 * | Array | List |
17 * | Boolean | Boolean |
18 * | String | String / Enum Value |
19 * | Number | Int / Float |
20 * | BigInt | Int |
21 * | Unknown | Enum Value |
22 * | null | NullValue |
23 *
24 */
25export declare function astFromValue(value: unknown, type: GraphQLInputType): Maybe<ValueNode>;