valueFromAST.d.ts 960 B

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