astFromValue.d.ts 801 B

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