GraphQLScalarType <TInternal, TExternal>
Implements
- GraphQLSchemaElement
Index
Constructors
constructor
Type parameters
- TInternal = unknown
- TExternal = TInternal
Parameters
config: Readonly<GraphQLScalarTypeConfig<TInternal, TExternal>>
Returns GraphQLScalarType<TInternal, TExternal>
Properties
astNode
coerceInputLiteral
coerceInputValue
coerceOutputValue
description
extensionASTNodes
extensions
name
parseLiteral
parseValue
serialize
specifiedByURL
valueToLiteral
Accessors
[toStringTag]
Returns string
Methods
toConfig
Returns GraphQLScalarTypeNormalizedConfig<TInternal, TExternal>
toJSON
Returns string
toString
Returns string
Scalar Type Definition
The leaf values of any request and input values to arguments are Scalars (or Enums) and are defined with a name and a series of functions used to parse input from ast or variables and to ensure validity.
If a type's coerceOutputValue function returns
null
or does not return a value (i.e. it returnsundefined
) then an error will be raised and anull
value will be returned in the response. It is always better to validate.Example:
Custom scalars behavior is defined via the following functions:
Deprecated, to be removed in v18:
coerceOutputValue()
.coerceInputValue()
.replaceVariables()
utility and thecoerceInputLiteral()
method.