Skip to main content

valueToLiteral

Callable


  • Produces a GraphQL Value AST given a JavaScript value and a GraphQL type.

    Scalar types are converted by calling the valueToLiteral method on that type, otherwise the default scalar valueToLiteral method is used, defined below.

    The provided value is an non-coerced "input" value. This function does not perform any coercion, however it does perform validation. Provided values which are invalid for the given type will result in an undefined return value.


    Parameters

    Returns ConstValueNode | undefined