valueFromAST.d.ts 1.0 KB

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