code: function isValidScalar(context: ValidationContext, node: ValueNode): void {
    // Report any error at the full type expected by the location.
    const locationType = context.getInputType();
    if (!locationType) {
      return;
    }
  
    const type = getNamedType(locationType);
  
    if (!isScalarType(type)) {
      context.reportError(
        new GraphQLError(
          badValueMessage(
            inspect(locationType),
            print(node),
            enumTypeSuggestion(type, node),
          ),
          node,
        ),
      );
      return;
    }
  
    // Scalars determine if a literal value is valid via parseLiteral() which
    // may throw or return an invalid value to indicate failure.
    try {
      const parseResult = type.parseLiteral(node, undefined /* variables */);
      if (isInvalid(parseResult)) {
        context.reportError(
          new GraphQLError(
            badValueMessage(inspect(locationType), print(node)),
            node,
          ),
        );
      }
    } catch (error) {
      // Ensure a reference to the original error is maintained.
      context.reportError(
        new GraphQLError(
          badValueMessage(inspect(locationType), print(node), error.message),
          node,
          undefined,
          undefined,
          undefined,
          error,
        ),
      );
    }
  }
docs: Any value literal may be a valid representation of a Scalar, depending on
  that scalar type.