@types/graphql
Version:
TypeScript definitions for graphql
23 lines (19 loc) • 647 B
TypeScript
import { GraphQLError } from "../error/GraphQLError";
import { ASTNode } from "../language/ast";
import { GraphQLInputType } from "../type/definition";
interface CoercedValue {
readonly errors: ReadonlyArray<GraphQLError> | undefined;
readonly value: any;
}
interface Path {
readonly prev: Path | undefined;
readonly key: string | number;
}
/**
* Coerces a JavaScript value given a GraphQL Type.
*
* Returns either a value which is valid for the provided type or a list of
* encountered coercion errors.
*
*/
export function coerceValue(value: any, type: GraphQLInputType, blameNode?: ASTNode, path?: Path): CoercedValue;