import { ApiSignature, ApiType } from '../../components/ApiCode';
Create and inspect GraphQL type definitions and schemas.
These exports are also available from the root `graphql` package.
For documentation purposes, these exports are grouped into the following categories:
- [Paths](/api-v17/type#category-paths)
- [Names](/api-v17/type#category-names)
- [Types](/api-v17/type#category-types)
- [Directives](/api-v17/type#category-directives)
- [Introspection](/api-v17/type#category-introspection)
- [Scalars](/api-v17/type#category-scalars)
- [Schema](/api-v17/type#category-schema)
- [Validation](/api-v17/type#category-validation)
## Category: Paths
<div className="api-category-toc">
<p>
<strong>Types:</strong><br />
<a href="/api-v17/type#responsepath">ResponsePath</a>
</p>
</div>
### Types
#### ResponsePath
**Interface.** Represents a linked response path from a field back to the root response.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>prev</td>
<td><ApiType parts={[["link", "Path", "/api-v17/type#responsepath"], " \u007c ", ["keyword", "undefined"]]} /></td>
<td>The previous segment in the linked response path, or undefined at the root.</td>
</tr>
<tr>
<td>key</td>
<td><ApiType parts={[["keyword", "string"], " \u007c ", ["keyword", "number"]]} /></td>
<td>The field name or list index for this response path segment.</td>
</tr>
<tr>
<td>typename</td>
<td><ApiType parts={[["keyword", "string"], " \u007c ", ["keyword", "undefined"]]} /></td>
<td>The runtime object type name associated with this path segment, if known.</td>
</tr>
</tbody>
</table>
## Category: Names
<div className="api-category-toc">
<p>
<strong>Functions:</strong><br />
<a href="/api-v17/type#assertname">assertName()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertenumvaluename">assertEnumValueName()</a>
</p>
</div>
### Functions
#### assertName()
Upholds the spec rules about naming.
**Signature:**
<ApiSignature parts={[["name", "assertName"], "(", ["parameter", "name"], ": ", ["keyword", "string"], "): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name to validate.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The validated GraphQL name.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { assertName } from 'graphql/type';
assertName('User'); // => 'User'
assertName('123User'); // throws an error
```
<hr className="api-item-divider" />
#### assertEnumValueName()
Upholds the spec rules about naming enum values.
**Signature:**
<ApiSignature parts={[["name", "assertEnumValueName"], "(", ["parameter", "name"], ": ", ["keyword", "string"], "): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name to validate.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The validated GraphQL name.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { assertEnumValueName } from 'graphql/type';
assertEnumValueName('ACTIVE'); // => 'ACTIVE'
assertEnumValueName('true'); // throws an error
```
## Category: Types
<div className="api-category-toc">
<p>
<strong>Classes:</strong><br />
<a href="/api-v17/type#graphqllist">GraphQLList</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlnonnull">GraphQLNonNull</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlscalartype">GraphQLScalarType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlobjecttype">GraphQLObjectType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlinterfacetype">GraphQLInterfaceType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqluniontype">GraphQLUnionType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlenumtype">GraphQLEnumType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlinputobjecttype">GraphQLInputObjectType</a>
</p>
<p>
<strong>Functions:</strong><br />
<a href="/api-v17/type#istype">isType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#asserttype">assertType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isscalartype">isScalarType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertscalartype">assertScalarType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isobjecttype">isObjectType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertobjecttype">assertObjectType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isfield">isField()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertfield">assertField()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isargument">isArgument()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertargument">assertArgument()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isinterfacetype">isInterfaceType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertinterfacetype">assertInterfaceType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isuniontype">isUnionType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertuniontype">assertUnionType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isenumtype">isEnumType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertenumtype">assertEnumType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isenumvalue">isEnumValue()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertenumvalue">assertEnumValue()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isinputobjecttype">isInputObjectType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertinputobjecttype">assertInputObjectType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isinputfield">isInputField()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertinputfield">assertInputField()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertlisttype">assertListType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertnonnulltype">assertNonNullType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isinputtype">isInputType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertinputtype">assertInputType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isoutputtype">isOutputType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertoutputtype">assertOutputType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isleaftype">isLeafType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertleaftype">assertLeafType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#iscompositetype">isCompositeType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertcompositetype">assertCompositeType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isabstracttype">isAbstractType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertabstracttype">assertAbstractType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#iswrappingtype">isWrappingType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertwrappingtype">assertWrappingType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isnullabletype">isNullableType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertnullabletype">assertNullableType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isnamedtype">isNamedType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertnamedtype">assertNamedType()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#resolvereadonlyarraythunk">resolveReadonlyArrayThunk()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#resolveobjmapthunk">resolveObjMapThunk()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isrequiredargument">isRequiredArgument()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isrequiredinputfield">isRequiredInputField()</a>
</p>
<p>
<strong>Types:</strong><br />
<a href="/api-v17/type#graphqltype">GraphQLType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlnullableinputtype">GraphQLNullableInputType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlinputtype">GraphQLInputType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlnullableoutputtype">GraphQLNullableOutputType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqloutputtype">GraphQLOutputType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlleaftype">GraphQLLeafType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlcompositetype">GraphQLCompositeType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlabstracttype">GraphQLAbstractType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlwrappingtype">GraphQLWrappingType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlnullabletype">GraphQLNullableType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlnamedtype">GraphQLNamedType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlnamedinputtype">GraphQLNamedInputType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlnamedoutputtype">GraphQLNamedOutputType</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#thunkreadonlyarray">ThunkReadonlyArray</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#thunkobjmap">ThunkObjMap</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlscalartypeextensions">GraphQLScalarTypeExtensions</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlscalarserializer">GraphQLScalarSerializer</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlscalaroutputvaluecoercer">GraphQLScalarOutputValueCoercer</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlscalarvalueparser">GraphQLScalarValueParser</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlscalarinputvaluecoercer">GraphQLScalarInputValueCoercer</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlscalarliteralparser">GraphQLScalarLiteralParser</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlscalarinputliteralcoercer">GraphQLScalarInputLiteralCoercer</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlscalartypeconfig">GraphQLScalarTypeConfig</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlobjecttypeextensions">GraphQLObjectTypeExtensions</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlobjecttypeconfig">GraphQLObjectTypeConfig</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqltyperesolver">GraphQLTypeResolver</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlistypeoffn">GraphQLIsTypeOfFn</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlfieldresolver">GraphQLFieldResolver</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlresolveinfohelpers">GraphQLResolveInfoHelpers</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlresolveinfo">GraphQLResolveInfo</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlfieldextensions">GraphQLFieldExtensions</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlfieldconfig">GraphQLFieldConfig</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlfieldconfigargumentmap">GraphQLFieldConfigArgumentMap</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlargumentextensions">GraphQLArgumentExtensions</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlargumentconfig">GraphQLArgumentConfig</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlfieldconfigmap">GraphQLFieldConfigMap</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlfield">GraphQLField</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlargument">GraphQLArgument</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlfieldmap">GraphQLFieldMap</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqldefaultinput">GraphQLDefaultInput</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlinterfacetypeextensions">GraphQLInterfaceTypeExtensions</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlinterfacetypeconfig">GraphQLInterfaceTypeConfig</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqluniontypeextensions">GraphQLUnionTypeExtensions</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqluniontypeconfig">GraphQLUnionTypeConfig</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlenumtypeextensions">GraphQLEnumTypeExtensions</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlenumtypeconfig">GraphQLEnumTypeConfig</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlenumvalueconfigmap">GraphQLEnumValueConfigMap</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlenumvalueextensions">GraphQLEnumValueExtensions</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlenumvalueconfig">GraphQLEnumValueConfig</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlenumvalue">GraphQLEnumValue</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlinputobjecttypeextensions">GraphQLInputObjectTypeExtensions</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlinputobjecttypeconfig">GraphQLInputObjectTypeConfig</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlinputfieldextensions">GraphQLInputFieldExtensions</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlinputfieldconfig">GraphQLInputFieldConfig</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlinputfieldconfigmap">GraphQLInputFieldConfigMap</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlinputfield">GraphQLInputField</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlinputfieldmap">GraphQLInputFieldMap</a>
</p>
</div>
### Classes
#### GraphQLList
List Type Wrapper
A list is a wrapping type which points to another type.
Lists are often created within the context of defining the fields of
an object type.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>T</td>
<td><ApiType parts={[["link", "GraphQLType", "/api-v17/type#graphqltype"]]} /></td>
<td></td>
<td>The GraphQL type wrapped by this list type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
const PersonType = new GraphQLObjectType({
name: 'Person',
fields: () => ({
parents: { type: new GraphQLList(PersonType) },
children: { type: new GraphQLList(PersonType) },
})
})
```
<hr className="api-subsection-divider" />
##### Constructor
Creates a GraphQLList instance.
**Signature:**
<ApiSignature parts={[["keyword", "new"], " ", ["name", "GraphQLList"], "(", ["parameter", "ofType"], ": ", ["type", "T"], ");"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>ofType</td>
<td><ApiType parts={[["type", "T"]]} /></td>
<td>The type to wrap.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### Members
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>ofType</td>
<td><ApiType parts={[["type", "T"]]} /></td>
<td>The type wrapped by this list or non-null type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### toString()
Returns this wrapping type as a GraphQL type-reference string.
**Signature:**
<ApiSignature parts={[["name", "toString"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL type-reference string.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLList, GraphQLNonNull, GraphQLString } from 'graphql/type';
const stringList = new GraphQLList(GraphQLString);
const requiredStringList = new GraphQLList(new GraphQLNonNull(GraphQLString));
stringList.toString(); // => '[String]'
requiredStringList.toString(); // => '[String!]'
```
<hr className="api-subsection-divider" />
##### toJSON()
Returns the JSON representation used when this object is serialized.
**Signature:**
<ApiSignature parts={[["name", "toJSON"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The JSON-serializable representation.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLList, GraphQLString } from 'graphql/type';
const stringList = new GraphQLList(GraphQLString);
stringList.toJSON(); // => '[String]'
JSON.stringify({ type: stringList }); // => '{"type":"[String]"}'
```
<hr className="api-item-divider" />
#### GraphQLNonNull
Non-Null Type Wrapper
A non-null is a wrapping type which points to another type.
Non-null types enforce that their values are never null and can ensure
an error is raised if this ever occurs during a request. It is useful for
fields which you can make a strong guarantee on non-nullability, for example
usually the id field of a database row will never be null.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>T</td>
<td><ApiType parts={[["link", "GraphQLNullableType", "/api-v17/type#graphqlnullabletype"]]} /></td>
<td></td>
<td>The nullable GraphQL type wrapped by this non-null type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
const RowType = new GraphQLObjectType({
name: 'Row',
fields: () => ({
id: { type: new GraphQLNonNull(GraphQLString) },
})
})
```
Note: the enforcement of non-nullability occurs within the executor.
<hr className="api-subsection-divider" />
##### Constructor
Creates a GraphQLNonNull instance.
**Signature:**
<ApiSignature parts={[["keyword", "new"], " ", ["name", "GraphQLNonNull"], "(", ["parameter", "ofType"], ": ", ["type", "T"], ");"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>ofType</td>
<td><ApiType parts={[["type", "T"]]} /></td>
<td>The type to wrap.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### Members
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>ofType</td>
<td><ApiType parts={[["type", "T"]]} /></td>
<td>The type wrapped by this list or non-null type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### toString()
Returns this wrapping type as a GraphQL type-reference string.
**Signature:**
<ApiSignature parts={[["name", "toString"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL type-reference string.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLList, GraphQLNonNull, GraphQLString } from 'graphql/type';
const requiredString = new GraphQLNonNull(GraphQLString);
const requiredStringList = new GraphQLNonNull(
new GraphQLList(GraphQLString),
);
requiredString.toString(); // => 'String!'
requiredStringList.toString(); // => '[String]!'
```
<hr className="api-subsection-divider" />
##### toJSON()
Returns the JSON representation used when this object is serialized.
**Signature:**
<ApiSignature parts={[["name", "toJSON"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The JSON-serializable representation.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLNonNull, GraphQLString } from 'graphql/type';
const requiredString = new GraphQLNonNull(GraphQLString);
requiredString.toJSON(); // => 'String!'
JSON.stringify({ type: requiredString }); // => '{"type":"String!"}'
```
<hr className="api-item-divider" />
#### GraphQLScalarType
Scalar Type Definition
Scalar types define the leaf values of a GraphQL response and the input
values accepted by arguments and input object fields. A scalar type has a
name and coercion functions that validate and convert runtime values and
GraphQL literals.
If a type's coerceOutputValue function returns `null` or does not return a
value (i.e. it returns `undefined`) then an error will be raised and a
`null` value will be returned in the response. Prefer validating inputs
before execution so clients receive input diagnostics before result coercion
fails.
Custom scalar behavior is defined via the following functions:
- coerceOutputValue(value): Implements "Result Coercion". Given an internal value,
produces an external value valid for this type. Returns undefined or
throws an error to indicate invalid values.
- coerceInputValue(value): Implements "Input Coercion" for values. Given an
external value (for example, variable values), produces an internal value
valid for this type. Returns undefined or throws an error to indicate
invalid values.
- coerceInputLiteral(ast): Implements "Input Coercion" for constant literals.
Given a GraphQL literal (AST) (for example, an argument value), produces
an internal value valid for this type. Returns undefined or throws an
error to indicate invalid values.
- valueToLiteral(value): Converts an external value to a GraphQL
literal (AST). Returns undefined or throws an error to indicate
invalid values.
Deprecated, to be removed in v18:
- serialize(value): Implements "Result Coercion". Renamed to
`coerceOutputValue()`.
- parseValue(value): Implements "Input Coercion" for values. Renamed to
`coerceInputValue()`.
- parseLiteral(ast): Implements "Input Coercion" for literals including
non-specified replacement of variables embedded within complex scalars.
Replaced by the combination of the `replaceVariables()` utility and the
`coerceInputLiteral()` method.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TInternal</td>
<td></td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Internal runtime representation for this scalar.</td>
</tr>
<tr>
<td>TExternal</td>
<td></td>
<td><ApiType parts={[["type", "TInternal"]]} /></td>
<td>External representation accepted from or returned to callers.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLScalarType, Kind } from 'graphql';
const ensureOdd = (value) => {
if (!Number.isFinite(value)) {
throw new Error(
`Scalar "Odd" cannot represent "${value}" since it is not a finite number.`,
);
}
if (value % 2 === 0) {
throw new Error(`Scalar "Odd" cannot represent "${value}" since it is even.`);
}
return value;
};
const OddType = new GraphQLScalarType({
name: 'Odd',
coerceOutputValue: (value) => {
return ensureOdd(value);
},
coerceInputValue: (value) => {
return ensureOdd(value);
},
valueToLiteral: (value) => {
return { kind: Kind.INT, value: String(ensureOdd(value)) };
}
});
```
<hr className="api-subsection-divider" />
##### Constructor
Creates a GraphQLScalarType instance.
**Signature:**
<ApiSignature parts={[["keyword", "new"], " ", ["name", "GraphQLScalarType"], "(\n ", ["parameter", "config"], ": ", ["type", "Readonly"], "\u003c\n ", ["link", "GraphQLScalarTypeConfig", "/api-v17/type#graphqlscalartypeconfig"], "\u003c", ["type", "TInternal"], ", ", ["type", "TExternal"], "\u003e\n \u003e,\n);"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>config</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c\n ", ["link", "GraphQLScalarTypeConfig", "/api-v17/type#graphqlscalartypeconfig"], "\u003c", ["type", "TInternal"], ", ", ["type", "TExternal"], "\u003e\n\u003e"]} /></td>
<td>Configuration describing this object.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### Members
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>specifiedByURL</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>URL identifying the behavior specified for this custom scalar.</td>
</tr>
<tr>
<td>serialize</td>
<td><ApiType parts={[["link", "GraphQLScalarSerializer", "/api-v17/type#graphqlscalarserializer"], "\u003c", ["type", "TExternal"], "\u003e"]} /></td>
<td>Deprecated legacy serializer used to convert internal values for response<br />
output. Use <code>{"coerceOutputValue()"}</code> instead.</td>
</tr>
<tr>
<td>parseValue</td>
<td><ApiType parts={[["link", "GraphQLScalarValueParser", "/api-v17/type#graphqlscalarvalueparser"], "\u003c", ["type", "TInternal"], "\u003e"]} /></td>
<td>Deprecated legacy parser used to convert externally provided input values.<br />
Use <code>{"coerceInputValue()"}</code> instead.</td>
</tr>
<tr>
<td>parseLiteral</td>
<td><ApiType parts={[["link", "GraphQLScalarLiteralParser", "/api-v17/type#graphqlscalarliteralparser"], "\u003c", ["type", "TInternal"], "\u003e"]} /></td>
<td>Deprecated legacy parser used to convert externally provided input<br />
literals. Use <code>{"replaceVariables()"}</code> and <code>{"coerceInputLiteral()"}</code> instead.</td>
</tr>
<tr>
<td>coerceOutputValue</td>
<td><ApiType parts={[["link", "GraphQLScalarOutputValueCoercer", "/api-v17/type#graphqlscalaroutputvaluecoercer"], "\u003c", ["type", "TExternal"], "\u003e"]} /></td>
<td>Coercer used to convert internal scalar values for response output.</td>
</tr>
<tr>
<td>coerceInputValue</td>
<td><ApiType parts={[["link", "GraphQLScalarInputValueCoercer", "/api-v17/type#graphqlscalarinputvaluecoercer"], "\u003c", ["type", "TInternal"], "\u003e"]} /></td>
<td>Coercer used to convert externally provided scalar input values.</td>
</tr>
<tr>
<td>coerceInputLiteral</td>
<td><ApiType parts={[["link", "GraphQLScalarInputLiteralCoercer", "/api-v17/type#graphqlscalarinputliteralcoercer"], "\u003c", ["type", "TInternal"], "\u003e \u007c ", ["keyword", "undefined"]]} /></td>
<td>Coercer used to convert GraphQL scalar input literals.</td>
</tr>
<tr>
<td>valueToLiteral</td>
<td><ApiType parts={[["type", "GraphQLScalarValueToLiteral"], " \u007c ", ["keyword", "undefined"]]} /></td>
<td>Converter used to produce GraphQL literals from runtime input values.</td>
</tr>
<tr>
<td>extensions</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c", ["link", "GraphQLScalarTypeExtensions", "/api-v17/type#graphqlscalartypeextensions"], "\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "ScalarTypeDefinitionNode", "/api-v17/language#scalartypedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
<tr>
<td>extensionASTNodes</td>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "ScalarTypeExtensionNode", "/api-v17/language#scalartypeextensionnode"], "[]"]} /></td>
<td>AST extension nodes applied to this schema element.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### toConfig()
Returns a normalized configuration object for this object.
**Signature:**
<ApiSignature parts={[["name", "toConfig"], "(): ", ["type", "GraphQLScalarTypeNormalizedConfig"], "\u003c\n ", ["type", "TInternal"], ",\n ", ["type", "TExternal"], "\n\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "GraphQLScalarTypeNormalizedConfig"], "\u003c", ["type", "TInternal"], ", ", ["type", "TExternal"], "\u003e"]} /></td>
<td>A configuration object that can be used to recreate this object.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLScalarType } from 'graphql/type';
const Url = new GraphQLScalarType({
name: 'Url',
description: 'An absolute URL string.',
specifiedByURL: 'https://url.spec.whatwg.org/',
});
const config = Url.toConfig();
const UrlCopy = new GraphQLScalarType(config);
config.name; // => 'Url'
config.specifiedByURL; // => 'https://url.spec.whatwg.org/'
UrlCopy.name; // => Url.name
```
<hr className="api-subsection-divider" />
##### toString()
Returns the schema coordinate identifying this scalar type.
**Signature:**
<ApiSignature parts={[["name", "toString"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The schema coordinate for this scalar type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLScalarType } from 'graphql/type';
const DateTime = new GraphQLScalarType({ name: 'DateTime' });
DateTime.toString(); // => 'DateTime'
String(DateTime); // => 'DateTime'
```
<hr className="api-subsection-divider" />
##### toJSON()
Returns the JSON representation used when this object is serialized.
**Signature:**
<ApiSignature parts={[["name", "toJSON"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The JSON-serializable representation.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLScalarType } from 'graphql/type';
const DateTime = new GraphQLScalarType({ name: 'DateTime' });
DateTime.toJSON(); // => 'DateTime'
JSON.stringify({ type: DateTime }); // => '{"type":"DateTime"}'
```
<hr className="api-item-divider" />
#### GraphQLObjectType
Object Type Definition
Almost all of the GraphQL types you define will be object types. Object types
have a name, but most importantly describe their fields.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TSource</td>
<td></td>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>Source object type passed to resolvers.</td>
</tr>
<tr>
<td>TContext</td>
<td></td>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>Context object type passed to resolvers.</td>
</tr>
<tr>
<td>TAbstract</td>
<td></td>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>Runtime value type used for abstract type resolution.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example 1</div>
```ts
const AddressType = new GraphQLObjectType({
name: 'Address',
fields: {
street: { type: GraphQLString },
number: { type: GraphQLInt },
formatted: {
type: GraphQLString,
resolve: (obj) => {
return obj.number + ' ' + obj.street
}
}
}
});
```
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example 2</div>
When two types need to refer to each other, or a type needs to refer to
itself in a field, you can use a function expression (aka a closure or a
thunk) to supply the fields lazily.
```ts
const PersonType = new GraphQLObjectType({
name: 'Person',
fields: () => ({
name: { type: GraphQLString },
bestFriend: { type: PersonType },
})
});
```
<hr className="api-subsection-divider" />
##### Constructor
Creates a GraphQLObjectType instance.
**Signature:**
<ApiSignature parts={[["keyword", "new"], " ", ["name", "GraphQLObjectType"], "(\n ", ["parameter", "config"], ": ", ["type", "Readonly"], "\u003c\n ", ["link", "GraphQLObjectTypeConfig", "/api-v17/type#graphqlobjecttypeconfig"], "\u003c\n ", ["type", "TSource"], ",\n ", ["type", "TContext"], ",\n ", ["type", "TAbstract"], "\n \u003e\n \u003e,\n);"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>config</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c\n ", ["link", "GraphQLObjectTypeConfig", "/api-v17/type#graphqlobjecttypeconfig"], "\u003c\n ", ["type", "TSource"], ",\n ", ["type", "TContext"], ",\n ", ["type", "TAbstract"], "\n \u003e\n\u003e"]} /></td>
<td>Configuration describing this object.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### Members
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>isTypeOf</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c\n ", ["link", "GraphQLIsTypeOfFn", "/api-v17/type#graphqlistypeoffn"], "\u003c", ["type", "TAbstract"], ", ", ["type", "TContext"], "\u003e\n\u003e"]} /></td>
<td>Predicate used to determine whether a runtime value belongs to this object type.</td>
</tr>
<tr>
<td>extensions</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c\n ", ["link", "GraphQLObjectTypeExtensions", "/api-v17/type#graphqlobjecttypeextensions"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e\n\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "ObjectTypeDefinitionNode", "/api-v17/language#objecttypedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
<tr>
<td>extensionASTNodes</td>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "ObjectTypeExtensionNode", "/api-v17/language#objecttypeextensionnode"], "[]"]} /></td>
<td>AST extension nodes applied to this schema element.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### getFields()
Returns the fields defined by this type.
**Signature:**
<ApiSignature parts={[["name", "getFields"], "(): ", ["link", "GraphQLFieldMap", "/api-v17/type#graphqlfieldmap"], "\u003c\n ", ["type", "TSource"], ",\n ", ["type", "TContext"], "\n\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLFieldMap", "/api-v17/type#graphqlfieldmap"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e"]} /></td>
<td>The fields keyed by field name.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertObjectType } from 'graphql/type';
const schema = buildSchema(`
type User {
id: ID!
name: String
}
type Query {
viewer: User
}
`);
const User = assertObjectType(schema.getType('User'));
const fields = User.getFields();
Object.keys(fields); // => ['id', 'name']
String(fields.id.type); // => 'ID!'
```
<hr className="api-subsection-divider" />
##### getInterfaces()
Returns the interfaces implemented by this type.
**Signature:**
<ApiSignature parts={[["name", "getInterfaces"], "(): ", ["keyword", "readonly"], " ", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"], "[];"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"], "[]"]} /></td>
<td>The implemented interfaces.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertObjectType } from 'graphql/type';
const schema = buildSchema(`
interface Node {
id: ID!
}
type User implements Node {
id: ID!
}
type Query {
viewer: User
}
`);
const User = assertObjectType(schema.getType('User'));
User.getInterfaces().map((type) => type.name); // => ['Node']
```
<hr className="api-subsection-divider" />
##### toConfig()
Returns a normalized configuration object for this object.
**Signature:**
<ApiSignature parts={[["name", "toConfig"], "(): ", ["type", "GraphQLObjectTypeNormalizedConfig"], "\u003c\n ", ["type", "TSource"], ",\n ", ["type", "TContext"], ",\n ", ["type", "TAbstract"], "\n\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "GraphQLObjectTypeNormalizedConfig"], "\u003c\n ", ["type", "TSource"], ",\n ", ["type", "TContext"], ",\n ", ["type", "TAbstract"], "\n\u003e"]} /></td>
<td>A configuration object that can be used to recreate this object.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLObjectType, GraphQLString } from 'graphql/type';
const User = new GraphQLObjectType({
name: 'User',
fields: {
name: { type: GraphQLString },
},
});
const config = User.toConfig();
const UserCopy = new GraphQLObjectType(config);
config.fields.name.type; // => GraphQLString
UserCopy.getFields().name.type; // => GraphQLString
```
<hr className="api-subsection-divider" />
##### toString()
Returns the schema coordinate identifying this object type.
**Signature:**
<ApiSignature parts={[["name", "toString"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The schema coordinate for this object type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertObjectType } from 'graphql/type';
const schema = buildSchema(`
type User {
name: String
}
type Query {
viewer: User
}
`);
const User = assertObjectType(schema.getType('User'));
User.toString(); // => 'User'
```
<hr className="api-subsection-divider" />
##### toJSON()
Returns the JSON representation used when this object is serialized.
**Signature:**
<ApiSignature parts={[["name", "toJSON"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The JSON-serializable representation.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLObjectType, GraphQLString } from 'graphql/type';
const User = new GraphQLObjectType({
name: 'User',
fields: { name: { type: GraphQLString } },
});
User.toJSON(); // => 'User'
JSON.stringify({ type: User }); // => '{"type":"User"}'
```
<hr className="api-item-divider" />
#### GraphQLInterfaceType
Interface Type Definition
When a field can return one of a heterogeneous set of types, a Interface type
is used to describe what types are possible, what fields are in common across
all types, as well as a function to determine which type is actually used
when the field is resolved.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TSource</td>
<td></td>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>Source object type passed to resolvers.</td>
</tr>
<tr>
<td>TContext</td>
<td></td>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>Context object type passed to resolvers.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
const EntityType = new GraphQLInterfaceType({
name: 'Entity',
fields: {
name: { type: GraphQLString }
}
});
```
<hr className="api-subsection-divider" />
##### Constructor
Creates a GraphQLInterfaceType instance.
**Signature:**
<ApiSignature parts={[["keyword", "new"], " ", ["name", "GraphQLInterfaceType"], "(\n ", ["parameter", "config"], ": ", ["type", "Readonly"], "\u003c\n ", ["link", "GraphQLInterfaceTypeConfig", "/api-v17/type#graphqlinterfacetypeconfig"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e\n \u003e,\n);"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>config</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c\n ", ["link", "GraphQLInterfaceTypeConfig", "/api-v17/type#graphqlinterfacetypeconfig"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e\n\u003e"]} /></td>
<td>Configuration describing this object.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### Members
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>resolveType</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c\n ", ["link", "GraphQLTypeResolver", "/api-v17/type#graphqltyperesolver"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e\n\u003e"]} /></td>
<td>Function that resolves the concrete object type for this abstract type.</td>
</tr>
<tr>
<td>extensions</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c", ["link", "GraphQLInterfaceTypeExtensions", "/api-v17/type#graphqlinterfacetypeextensions"], "\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "InterfaceTypeDefinitionNode", "/api-v17/language#interfacetypedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
<tr>
<td>extensionASTNodes</td>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "InterfaceTypeExtensionNode", "/api-v17/language#interfacetypeextensionnode"], "[]"]} /></td>
<td>AST extension nodes applied to this schema element.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### getFields()
Returns the fields defined by this type.
**Signature:**
<ApiSignature parts={[["name", "getFields"], "(): ", ["link", "GraphQLFieldMap", "/api-v17/type#graphqlfieldmap"], "\u003c\n ", ["type", "TSource"], ",\n ", ["type", "TContext"], "\n\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLFieldMap", "/api-v17/type#graphqlfieldmap"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e"]} /></td>
<td>The fields keyed by field name.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertInterfaceType } from 'graphql/type';
const schema = buildSchema(`
interface Node {
id: ID!
}
type User implements Node {
id: ID!
}
type Query {
node: Node
}
`);
const Node = assertInterfaceType(schema.getType('Node'));
const fields = Node.getFields();
Object.keys(fields); // => ['id']
String(fields.id.type); // => 'ID!'
```
<hr className="api-subsection-divider" />
##### getInterfaces()
Returns the interfaces implemented by this type.
**Signature:**
<ApiSignature parts={[["name", "getInterfaces"], "(): ", ["keyword", "readonly"], " ", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"], "[];"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"], "[]"]} /></td>
<td>The implemented interfaces.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertInterfaceType } from 'graphql/type';
const schema = buildSchema(`
interface Resource {
url: String!
}
interface Image implements Resource {
url: String!
width: Int
}
type Photo implements Resource & Image {
url: String!
width: Int
}
type Query {
image: Image
}
`);
const Image = assertInterfaceType(schema.getType('Image'));
Image.getInterfaces().map((type) => type.name); // => ['Resource']
```
<hr className="api-subsection-divider" />
##### toConfig()
Returns a normalized configuration object for this object.
**Signature:**
<ApiSignature parts={[["name", "toConfig"], "(): ", ["type", "GraphQLInterfaceTypeNormalizedConfig"], "\u003c\n ", ["type", "TSource"], ",\n ", ["type", "TContext"], "\n\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "GraphQLInterfaceTypeNormalizedConfig"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e"]} /></td>
<td>A configuration object that can be used to recreate this object.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLID, GraphQLInterfaceType, GraphQLNonNull } from 'graphql/type';
const Node = new GraphQLInterfaceType({
name: 'Node',
fields: {
id: { type: new GraphQLNonNull(GraphQLID) },
},
});
const config = Node.toConfig();
const NodeCopy = new GraphQLInterfaceType(config);
String(config.fields.id.type); // => 'ID!'
String(NodeCopy.getFields().id.type); // => 'ID!'
```
<hr className="api-subsection-divider" />
##### toString()
Returns the schema coordinate identifying this interface type.
**Signature:**
<ApiSignature parts={[["name", "toString"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The schema coordinate for this interface type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertInterfaceType } from 'graphql/type';
const schema = buildSchema(`
interface Node {
id: ID!
}
type User implements Node {
id: ID!
}
type Query {
node: Node
}
`);
const Node = assertInterfaceType(schema.getType('Node'));
Node.toString(); // => 'Node'
```
<hr className="api-subsection-divider" />
##### toJSON()
Returns the JSON representation used when this object is serialized.
**Signature:**
<ApiSignature parts={[["name", "toJSON"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The JSON-serializable representation.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLInterfaceType, GraphQLString } from 'graphql/type';
const Named = new GraphQLInterfaceType({
name: 'Named',
fields: { name: { type: GraphQLString } },
});
Named.toJSON(); // => 'Named'
JSON.stringify({ type: Named }); // => '{"type":"Named"}'
```
<hr className="api-item-divider" />
#### GraphQLUnionType
Union Type Definition
When a field can return one of a heterogeneous set of types, a Union type
is used to describe what types are possible as well as providing a function
to determine which type is actually used when the field is resolved.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TSource</td>
<td></td>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>Source object type passed to resolvers.</td>
</tr>
<tr>
<td>TContext</td>
<td></td>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>Context object type passed to resolvers.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
const PetType = new GraphQLUnionType({
name: 'Pet',
types: [DogType, CatType],
resolveType: (value) => {
if (value instanceof Dog) {
return DogType;
}
if (value instanceof Cat) {
return CatType;
}
}
});
```
<hr className="api-subsection-divider" />
##### Constructor
Creates a GraphQLUnionType instance.
**Signature:**
<ApiSignature parts={[["keyword", "new"], " ", ["name", "GraphQLUnionType"], "(\n ", ["parameter", "config"], ": ", ["type", "Readonly"], "\u003c\n ", ["link", "GraphQLUnionTypeConfig", "/api-v17/type#graphqluniontypeconfig"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e\n \u003e,\n);"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>config</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c\n ", ["link", "GraphQLUnionTypeConfig", "/api-v17/type#graphqluniontypeconfig"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e\n\u003e"]} /></td>
<td>Configuration describing this object.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### Members
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>resolveType</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c\n ", ["link", "GraphQLTypeResolver", "/api-v17/type#graphqltyperesolver"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e\n\u003e"]} /></td>
<td>Function that resolves the concrete object type for this abstract type.</td>
</tr>
<tr>
<td>extensions</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c", ["link", "GraphQLUnionTypeExtensions", "/api-v17/type#graphqluniontypeextensions"], "\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "UnionTypeDefinitionNode", "/api-v17/language#uniontypedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
<tr>
<td>extensionASTNodes</td>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "UnionTypeExtensionNode", "/api-v17/language#uniontypeextensionnode"], "[]"]} /></td>
<td>AST extension nodes applied to this schema element.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### getTypes()
Returns the object types included in this union.
**Signature:**
<ApiSignature parts={[["name", "getTypes"], "(): ", ["keyword", "readonly"], " ", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "[];"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "[]"]} /></td>
<td>The union member object types.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertUnionType } from 'graphql/type';
const schema = buildSchema(`
type Photo {
url: String!
}
type Video {
url: String!
}
union Media = Photo | Video
type Query {
media: [Media]
}
`);
const Media = assertUnionType(schema.getType('Media'));
Media.getTypes().map((type) => type.name); // => ['Photo', 'Video']
```
<hr className="api-subsection-divider" />
##### toConfig()
Returns a normalized configuration object for this object.
**Signature:**
<ApiSignature parts={[["name", "toConfig"], "(): ", ["type", "GraphQLUnionTypeNormalizedConfig"], "\u003c\n ", ["type", "TSource"], ",\n ", ["type", "TContext"], "\n\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "GraphQLUnionTypeNormalizedConfig"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e"]} /></td>
<td>A configuration object that can be used to recreate this object.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLObjectType, GraphQLString, GraphQLUnionType } from 'graphql/type';
const Photo = new GraphQLObjectType({
name: 'Photo',
fields: { url: { type: GraphQLString } },
});
const Video = new GraphQLObjectType({
name: 'Video',
fields: { url: { type: GraphQLString } },
});
const Media = new GraphQLUnionType({
name: 'Media',
types: [Photo, Video],
});
const config = Media.toConfig();
const MediaCopy = new GraphQLUnionType(config);
MediaCopy.getTypes().map((type) => type.name); // => ['Photo', 'Video']
```
<hr className="api-subsection-divider" />
##### toString()
Returns the schema coordinate identifying this union type.
**Signature:**
<ApiSignature parts={[["name", "toString"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The schema coordinate for this union type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertUnionType } from 'graphql/type';
const schema = buildSchema(`
type Photo {
url: String!
}
union SearchResult = Photo
type Query {
search: [SearchResult]
}
`);
const SearchResult = assertUnionType(schema.getType('SearchResult'));
SearchResult.toString(); // => 'SearchResult'
```
<hr className="api-subsection-divider" />
##### toJSON()
Returns the JSON representation used when this object is serialized.
**Signature:**
<ApiSignature parts={[["name", "toJSON"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The JSON-serializable representation.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLObjectType, GraphQLString, GraphQLUnionType } from 'graphql/type';
const Photo = new GraphQLObjectType({
name: 'Photo',
fields: { url: { type: GraphQLString } },
});
const SearchResult = new GraphQLUnionType({
name: 'SearchResult',
types: [Photo],
});
SearchResult.toJSON(); // => 'SearchResult'
JSON.stringify({ type: SearchResult }); // => '{"type":"SearchResult"}'
```
<hr className="api-item-divider" />
#### GraphQLEnumType
Enum Type Definition
Enum types define leaf values whose serialized form is one of a fixed set
of GraphQL enum names. Internally, enum values can map to any runtime value,
often integers.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLEnumType } from 'graphql/type';
const RGBType = new GraphQLEnumType({
name: 'RGB',
values: {
RED: { value: 0 },
GREEN: { value: 1 },
BLUE: { value: 2 },
},
});
RGBType.getValue('GREEN')?.value; // => 1
```
Note: If a value is not provided in a definition, the name of the enum value
will be used as its internal value.
<hr className="api-subsection-divider" />
##### Constructor
Creates a GraphQLEnumType instance.
**Signature:**
<ApiSignature parts={[["keyword", "new"], " ", ["name", "GraphQLEnumType"], "(", ["parameter", "config"], ": ", ["type", "Readonly"], "\u003c", ["link", "GraphQLEnumTypeConfig", "/api-v17/type#graphqlenumtypeconfig"], "\u003e);"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>config</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c", ["link", "GraphQLEnumTypeConfig", "/api-v17/type#graphqlenumtypeconfig"], "\u003e"]} /></td>
<td>Configuration describing this object.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### Members
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>extensions</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c", ["link", "GraphQLEnumTypeExtensions", "/api-v17/type#graphqlenumtypeextensions"], "\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "EnumTypeDefinitionNode", "/api-v17/language#enumtypedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
<tr>
<td>extensionASTNodes</td>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "EnumTypeExtensionNode", "/api-v17/language#enumtypeextensionnode"], "[]"]} /></td>
<td>AST extension nodes applied to this schema element.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### getValues()
Returns the values defined by this enum type.
**Signature:**
<ApiSignature parts={[["name", "getValues"], "(): ", ["keyword", "readonly"], " ", ["link", "GraphQLEnumValue", "/api-v17/type#graphqlenumvalue"], "[];"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "GraphQLEnumValue", "/api-v17/type#graphqlenumvalue"], "[]"]} /></td>
<td>Enum value definitions in schema order.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertEnumType } from 'graphql/type';
const schema = buildSchema(`
enum Episode {
NEW_HOPE
EMPIRE
JEDI
}
type Query {
episode: Episode
}
`);
const Episode = assertEnumType(schema.getType('Episode'));
Episode.getValues().map((value) => value.name); // => ['NEW_HOPE', 'EMPIRE', 'JEDI']
```
<hr className="api-subsection-divider" />
##### getValue()
Returns the enum value definition for a value name.
**Signature:**
<ApiSignature parts={[["name", "getValue"], "(\n ", ["parameter", "name"], ": ", ["keyword", "string"], ",\n): ", ["type", "Maybe"], "\u003c", ["link", "GraphQLEnumValue", "/api-v17/type#graphqlenumvalue"], "\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name to look up.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "GraphQLEnumValue", "/api-v17/type#graphqlenumvalue"], "\u003e"]} /></td>
<td>The matching enum value definition, if it exists.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertEnumType } from 'graphql/type';
const schema = buildSchema(`
enum Episode {
NEW_HOPE
EMPIRE
}
type Query {
episode: Episode
}
`);
const Episode = assertEnumType(schema.getType('Episode'));
Episode.getValue('EMPIRE')?.name; // => 'EMPIRE'
Episode.getValue('JEDI'); // => undefined
```
<hr className="api-subsection-divider" />
##### serialize() <span aria-label="Deprecated" className="api-tag" title="Deprecated">Deprecated</span>
Serializes a runtime enum value as a GraphQL enum name.
**Signature:**
<ApiSignature parts={[["name", "serialize"], "(\n ", ["parameter", "outputValue"], ": ", ["keyword", "unknown"], ",\n): ", ["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>outputValue</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Runtime enum value to serialize.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>The GraphQL enum name for the runtime value.<br />
This deprecated method delegates to <code>{"coerceOutputValue()"}</code>; call<br />
<code>{"coerceOutputValue()"}</code> directly instead.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLEnumType } from 'graphql/type';
const RGB = new GraphQLEnumType({
name: 'RGB',
values: {
RED: { value: 0 },
GREEN: { value: 1 },
BLUE: { value: 2 },
},
});
RGB.serialize(1); // => 'GREEN'
RGB.serialize(3); // throws an error
```
<hr className="api-subsection-divider" />
##### coerceOutputValue()
Coerces a runtime enum value to a GraphQL enum name.
**Signature:**
<ApiSignature parts={[["name", "coerceOutputValue"], "(\n ", ["parameter", "outputValue"], ": ", ["keyword", "unknown"], ",\n): ", ["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>outputValue</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Runtime enum value to coerce.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>The GraphQL enum name for the runtime value.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLEnumType } from 'graphql/type';
const RGB = new GraphQLEnumType({
name: 'RGB',
values: {
RED: { value: 0 },
GREEN: { value: 1 },
BLUE: { value: 2 },
},
});
RGB.coerceOutputValue(1); // => 'GREEN'
RGB.coerceOutputValue(3); // throws an error
```
<hr className="api-subsection-divider" />
##### parseValue() <span aria-label="Deprecated" className="api-tag" title="Deprecated">Deprecated</span>
Deprecated legacy enum parser for externally provided input values. Use
`coerceInputValue()` instead.
**Signature:**
<ApiSignature parts={[["name", "parseValue"], "(\n ", ["parameter", "inputValue"], ": ", ["keyword", "unknown"], ",\n ", ["parameter", "hideSuggestions"], "?: ", ["type", "Maybe"], "\u003c", ["keyword", "boolean"], "\u003e,\n): ", ["keyword", "any"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>inputValue</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>External enum name to parse.</td>
</tr>
<tr>
<td>hideSuggestions?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "boolean"], "\u003e"]} /></td>
<td>Whether suggestion text should be omitted from errors.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>The internal runtime value for the enum name.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLEnumType } from 'graphql/type';
const RGB = new GraphQLEnumType({
name: 'RGB',
values: {
RED: { value: 0 },
GREEN: { value: 1 },
BLUE: { value: 2 },
},
});
RGB.parseValue('BLUE'); // => 2
RGB.parseValue('PURPLE', true); // throws an error
```
<hr className="api-subsection-divider" />
##### coerceInputValue()
Coerces an external enum name to its internal runtime value.
**Signature:**
<ApiSignature parts={[["name", "coerceInputValue"], "(\n ", ["parameter", "inputValue"], ": ", ["keyword", "unknown"], ",\n ", ["parameter", "hideSuggestions"], "?: ", ["type", "Maybe"], "\u003c", ["keyword", "boolean"], "\u003e,\n): ", ["keyword", "any"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>inputValue</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>External enum name to coerce.</td>
</tr>
<tr>
<td>hideSuggestions?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "boolean"], "\u003e"]} /></td>
<td>Whether suggestion text should be omitted from errors.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>The internal runtime value for the enum name.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLEnumType } from 'graphql/type';
const RGB = new GraphQLEnumType({
name: 'RGB',
values: {
RED: { value: 0 },
GREEN: { value: 1 },
BLUE: { value: 2 },
},
});
RGB.coerceInputValue('BLUE'); // => 2
RGB.coerceInputValue('PURPLE'); // throws an error
RGB.coerceInputValue(2); // throws an error
```
<hr className="api-subsection-divider" />
##### parseLiteral() <span aria-label="Deprecated" className="api-tag" title="Deprecated">Deprecated</span>
Deprecated legacy enum parser for externally provided input literals. Use
`coerceInputLiteral()` instead.
**Signature:**
<ApiSignature parts={[["name", "parseLiteral"], "(\n ", ["parameter", "valueNode"], ": ", ["link", "ValueNode", "/api-v17/language#valuenode"], ",\n ", ["parameter", "_variables"], ": ", ["type", "Maybe"], "\u003c", ["type", "ObjMap"], "\u003c", ["keyword", "unknown"], "\u003e\u003e,\n ", ["parameter", "hideSuggestions"], "?: ", ["type", "Maybe"], "\u003c", ["keyword", "boolean"], "\u003e,\n): ", ["keyword", "any"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>valueNode</td>
<td><ApiType parts={[["link", "ValueNode", "/api-v17/language#valuenode"]]} /></td>
<td>Enum value AST node to parse.</td>
</tr>
<tr>
<td>_variables</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["type", "ObjMap"], "\u003c", ["keyword", "unknown"], "\u003e\u003e"]} /></td>
<td>Deprecated variable values parameter that is no longer used.</td>
</tr>
<tr>
<td>hideSuggestions?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "boolean"], "\u003e"]} /></td>
<td>Whether suggestion text should be omitted from errors.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>The internal runtime value for the enum literal.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { parseValue } from 'graphql/language';
import { GraphQLEnumType } from 'graphql/type';
const RGB = new GraphQLEnumType({
name: 'RGB',
values: {
RED: { value: 0 },
GREEN: { value: 1 },
BLUE: { value: 2 },
},
});
RGB.parseLiteral(parseValue('RED')); // => 0
RGB.parseLiteral(parseValue('"RED"')); // throws an error
```
<hr className="api-subsection-divider" />
##### coerceInputLiteral()
Coerces an enum value AST node to its internal runtime value.
**Signature:**
<ApiSignature parts={[["name", "coerceInputLiteral"], "(\n ", ["parameter", "valueNode"], ": ", ["link", "ConstValueNode", "/api-v17/language#constvaluenode"], ",\n ", ["parameter", "hideSuggestions"], "?: ", ["type", "Maybe"], "\u003c", ["keyword", "boolean"], "\u003e,\n): ", ["keyword", "any"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>valueNode</td>
<td><ApiType parts={[["link", "ConstValueNode", "/api-v17/language#constvaluenode"]]} /></td>
<td>Enum value AST node to coerce.</td>
</tr>
<tr>
<td>hideSuggestions?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "boolean"], "\u003e"]} /></td>
<td>Whether suggestion text should be omitted from errors.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>The internal runtime value for the enum literal.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { parseConstValue } from 'graphql/language';
import { GraphQLEnumType } from 'graphql/type';
const RGB = new GraphQLEnumType({
name: 'RGB',
values: {
RED: { value: 0 },
GREEN: { value: 1 },
BLUE: { value: 2 },
},
});
RGB.coerceInputLiteral(parseConstValue('RED')); // => 0
RGB.coerceInputLiteral(parseConstValue('"RED"'), true); // throws an error
```
<hr className="api-subsection-divider" />
##### valueToLiteral()
Converts a runtime enum value to a GraphQL enum value AST node.
**Signature:**
<ApiSignature parts={[["name", "valueToLiteral"], "(\n ", ["parameter", "value"], ": ", ["keyword", "unknown"], ",\n): ", ["link", "ConstValueNode", "/api-v17/language#constvaluenode"], " \u007c ", ["keyword", "undefined"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>value</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Runtime enum value to convert.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "ConstValueNode", "/api-v17/language#constvaluenode"], " \u007c ", ["keyword", "undefined"]]} /></td>
<td>Enum value AST node, or undefined if the value is invalid.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { print } from 'graphql/language';
import { GraphQLEnumType } from 'graphql/type';
const RGB = new GraphQLEnumType({
name: 'RGB',
values: {
RED: { value: 0 },
GREEN: { value: 1 },
BLUE: { value: 2 },
},
});
print(RGB.valueToLiteral(2)); // => 'BLUE'
RGB.valueToLiteral(3); // => undefined
```
<hr className="api-subsection-divider" />
##### toConfig()
Returns a normalized configuration object for this object.
**Signature:**
<ApiSignature parts={[["name", "toConfig"], "(): ", ["type", "GraphQLEnumTypeNormalizedConfig"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "GraphQLEnumTypeNormalizedConfig"]]} /></td>
<td>A configuration object that can be used to recreate this object.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLEnumType } from 'graphql/type';
const RGB = new GraphQLEnumType({
name: 'RGB',
values: {
RED: { value: 0 },
GREEN: { value: 1 },
BLUE: { value: 2 },
},
});
const config = RGB.toConfig();
const RGBCopy = new GraphQLEnumType(config);
config.values.GREEN.value; // => 1
RGBCopy.coerceOutputValue(2); // => 'BLUE'
```
<hr className="api-subsection-divider" />
##### toString()
Returns the schema coordinate identifying this enum type.
**Signature:**
<ApiSignature parts={[["name", "toString"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The schema coordinate for this enum type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertEnumType } from 'graphql/type';
const schema = buildSchema(`
enum Episode {
NEW_HOPE
}
type Query {
episode: Episode
}
`);
const Episode = assertEnumType(schema.getType('Episode'));
Episode.toString(); // => 'Episode'
```
<hr className="api-subsection-divider" />
##### toJSON()
Returns the JSON representation used when this object is serialized.
**Signature:**
<ApiSignature parts={[["name", "toJSON"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The JSON-serializable representation.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLEnumType } from 'graphql/type';
const Episode = new GraphQLEnumType({
name: 'Episode',
values: {
NEW_HOPE: {},
},
});
Episode.toJSON(); // => 'Episode'
JSON.stringify({ type: Episode }); // => '{"type":"Episode"}'
```
<hr className="api-item-divider" />
#### GraphQLInputObjectType
Input Object Type Definition
An input object defines a structured collection of fields which may be
supplied to a field argument.
Using `NonNull` will ensure that a value must be provided by the query
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
const GeoPoint = new GraphQLInputObjectType({
name: 'GeoPoint',
fields: {
lat: { type: new GraphQLNonNull(GraphQLFloat) },
lon: { type: new GraphQLNonNull(GraphQLFloat) },
alt: { type: GraphQLFloat, default: { value: 0 } },
}
});
```
<hr className="api-subsection-divider" />
##### Constructor
Creates a GraphQLInputObjectType instance.
**Signature:**
<ApiSignature parts={[["keyword", "new"], " ", ["name", "GraphQLInputObjectType"], "(", ["parameter", "config"], ": ", ["type", "Readonly"], "\u003c", ["link", "GraphQLInputObjectTypeConfig", "/api-v17/type#graphqlinputobjecttypeconfig"], "\u003e);"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>config</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c", ["link", "GraphQLInputObjectTypeConfig", "/api-v17/type#graphqlinputobjecttypeconfig"], "\u003e"]} /></td>
<td>Configuration describing this object.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### Members
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>extensions</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c", ["link", "GraphQLInputObjectTypeExtensions", "/api-v17/type#graphqlinputobjecttypeextensions"], "\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "InputObjectTypeDefinitionNode", "/api-v17/language#inputobjecttypedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
<tr>
<td>extensionASTNodes</td>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "InputObjectTypeExtensionNode", "/api-v17/language#inputobjecttypeextensionnode"], "[]"]} /></td>
<td>AST extension nodes applied to this schema element.</td>
</tr>
<tr>
<td>isOneOf</td>
<td><ApiType parts={[["keyword", "boolean"]]} /></td>
<td>Whether this input object uses the experimental OneOf input object semantics.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### getFields()
Returns the fields defined by this type.
**Signature:**
<ApiSignature parts={[["name", "getFields"], "(): ", ["link", "GraphQLInputFieldMap", "/api-v17/type#graphqlinputfieldmap"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLInputFieldMap", "/api-v17/type#graphqlinputfieldmap"]]} /></td>
<td>The fields keyed by field name.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertInputObjectType } from 'graphql/type';
const schema = buildSchema(`
input ReviewInput {
stars: Int!
commentary: String = ""
}
type Query {
reviews(filter: ReviewInput): [String]
}
`);
const ReviewInput = assertInputObjectType(schema.getType('ReviewInput'));
const fields = ReviewInput.getFields();
Object.keys(fields); // => ['stars', 'commentary']
fields.commentary.default; // => { literal: { kind: 'StringValue', value: '' } }
```
<hr className="api-subsection-divider" />
##### toConfig()
Returns a normalized configuration object for this object.
**Signature:**
<ApiSignature parts={[["name", "toConfig"], "(): ", ["type", "GraphQLInputObjectTypeNormalizedConfig"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "GraphQLInputObjectTypeNormalizedConfig"]]} /></td>
<td>A configuration object that can be used to recreate this object.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import {
GraphQLInputObjectType,
GraphQLInt,
GraphQLNonNull,
} from 'graphql/type';
const ReviewInput = new GraphQLInputObjectType({
name: 'ReviewInput',
fields: {
stars: { type: new GraphQLNonNull(GraphQLInt) },
},
});
const config = ReviewInput.toConfig();
const ReviewInputCopy = new GraphQLInputObjectType(config);
String(config.fields.stars.type); // => 'Int!'
String(ReviewInputCopy.getFields().stars.type); // => 'Int!'
```
<hr className="api-subsection-divider" />
##### toString()
Returns the schema coordinate identifying this input object type.
**Signature:**
<ApiSignature parts={[["name", "toString"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The schema coordinate for this input object type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertInputObjectType } from 'graphql/type';
const schema = buildSchema(`
input ReviewInput {
stars: Int!
}
type Query {
reviews(filter: ReviewInput): [String]
}
`);
const ReviewInput = assertInputObjectType(schema.getType('ReviewInput'));
ReviewInput.toString(); // => 'ReviewInput'
```
<hr className="api-subsection-divider" />
##### toJSON()
Returns the JSON representation used when this object is serialized.
**Signature:**
<ApiSignature parts={[["name", "toJSON"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The JSON-serializable representation.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLInputObjectType, GraphQLString } from 'graphql/type';
const ReviewInput = new GraphQLInputObjectType({
name: 'ReviewInput',
fields: {
commentary: { type: GraphQLString },
},
});
ReviewInput.toJSON(); // => 'ReviewInput'
JSON.stringify({ type: ReviewInput }); // => '{"type":"ReviewInput"}'
```
### Functions
#### isType()
Returns true when the value is any GraphQL type.
**Signature:**
<ApiSignature parts={[["name", "isType"], "(\n ", ["parameter", "type"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLType", "/api-v17/type#graphqltype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLType", "/api-v17/type#graphqltype"]]} /></td>
<td>True when the value is any GraphQL type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { GraphQLList, GraphQLString, isType } from 'graphql/type';
const schema = buildSchema(`
type Query {
name: String
}
`);
isType(GraphQLString); // => true
isType(new GraphQLList(GraphQLString)); // => true
isType(schema.getType('Query')); // => true
isType('String'); // => false
```
<hr className="api-item-divider" />
#### assertType()
Returns the value as a GraphQL type, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertType"], "(", ["parameter", "type"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLType", "/api-v17/type#graphqltype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLType", "/api-v17/type#graphqltype"]]} /></td>
<td>The value typed as a GraphQL type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertType } from 'graphql/type';
const schema = buildSchema(`
type Query {
name: String
}
`);
const queryType = assertType(schema.getType('Query'));
queryType.toString(); // => 'Query'
assertType('Query'); // throws an error
```
<hr className="api-item-divider" />
#### isScalarType()
There are predicates for each kind of GraphQL type.
**Signature:**
<ApiSignature parts={[["name", "isScalarType"], "(\n ", ["parameter", "type"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLScalarType", "/api-v17/type#graphqlscalartype"], "\u003c", ["keyword", "unknown"], ", ", ["keyword", "unknown"], "\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLScalarType", "/api-v17/type#graphqlscalartype"], "\u003c", ["keyword", "unknown"], ", ", ["keyword", "unknown"], "\u003e"]} /></td>
<td>True when the value is a GraphQLScalarType.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { isScalarType } from 'graphql/type';
const schema = buildSchema(`
scalar DateTime
type Query {
createdAt: DateTime
}
`);
isScalarType(schema.getType('DateTime')); // => true
isScalarType(schema.getType('Query')); // => false
```
<hr className="api-item-divider" />
#### assertScalarType()
Returns the value as a GraphQLScalarType, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertScalarType"], "(", ["parameter", "type"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLScalarType", "/api-v17/type#graphqlscalartype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLScalarType", "/api-v17/type#graphqlscalartype"]]} /></td>
<td>The value typed as a GraphQLScalarType.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertScalarType } from 'graphql/type';
const schema = buildSchema(`
scalar DateTime
type Query {
createdAt: DateTime
}
`);
const dateTimeType = assertScalarType(schema.getType('DateTime'));
dateTimeType.name; // => 'DateTime'
assertScalarType(schema.getType('Query')); // throws an error
```
<hr className="api-item-divider" />
#### isObjectType()
Returns true when the value is a GraphQLObjectType.
**Signature:**
<ApiSignature parts={[["name", "isObjectType"], "(\n ", ["parameter", "type"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"]]} /></td>
<td>True when the value is a GraphQLObjectType.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { isObjectType } from 'graphql/type';
const schema = buildSchema(`
input ReviewInput {
stars: Int!
}
type User {
name: String
}
type Query {
user: User
}
`);
isObjectType(schema.getType('User')); // => true
isObjectType(schema.getType('ReviewInput')); // => false
```
<hr className="api-item-divider" />
#### assertObjectType()
Returns the value as a GraphQLObjectType, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertObjectType"], "(", ["parameter", "type"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"]]} /></td>
<td>The value typed as a GraphQLObjectType.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertObjectType } from 'graphql/type';
const schema = buildSchema(`
input ReviewInput {
stars: Int!
}
type User {
name: String
}
type Query {
user: User
}
`);
const userType = assertObjectType(schema.getType('User'));
Object.keys(userType.getFields()); // => ['name']
assertObjectType(schema.getType('ReviewInput')); // throws an error
```
<hr className="api-item-divider" />
#### isField()
Returns true when the value is a resolved GraphQL field definition.
**Signature:**
<ApiSignature parts={[["name", "isField"], "(\n ", ["parameter", "field"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "field"], " ", ["keyword", "is"], " ", ["link", "GraphQLField", "/api-v17/type#graphqlfield"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>field</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Value to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "field"], " ", ["keyword", "is"], " ", ["link", "GraphQLField", "/api-v17/type#graphqlfield"]]} /></td>
<td>True when the value is a GraphQLField.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { isField } from 'graphql/type';
const schema = buildSchema('type Query { greeting: String }');
const field = schema.getQueryType().getFields().greeting;
isField(field); // => true
isField(schema.getQueryType()); // => false
```
<hr className="api-item-divider" />
#### assertField()
Returns the value as a GraphQLField, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertField"], "(", ["parameter", "field"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLField", "/api-v17/type#graphqlfield"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>field</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Value to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLField", "/api-v17/type#graphqlfield"]]} /></td>
<td>The value typed as a GraphQLField.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertField } from 'graphql/type';
const schema = buildSchema('type Query { greeting: String }');
const field = assertField(schema.getQueryType().getFields().greeting);
field.name; // => 'greeting'
assertField(schema.getQueryType()); // throws an error
```
<hr className="api-item-divider" />
#### isArgument()
Returns true when the value is a resolved GraphQL argument definition.
**Signature:**
<ApiSignature parts={[["name", "isArgument"], "(\n ", ["parameter", "arg"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "arg"], " ", ["keyword", "is"], " ", ["link", "GraphQLArgument", "/api-v17/type#graphqlargument"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>arg</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Value to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "arg"], " ", ["keyword", "is"], " ", ["link", "GraphQLArgument", "/api-v17/type#graphqlargument"]]} /></td>
<td>True when the value is a GraphQLArgument.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { isArgument } from 'graphql/type';
const schema = buildSchema('type Query { greeting(name: String): String }');
const arg = schema.getQueryType().getFields().greeting.args[0];
isArgument(arg); // => true
isArgument(schema.getQueryType()); // => false
```
<hr className="api-item-divider" />
#### assertArgument()
Returns the value as a GraphQLArgument, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertArgument"], "(", ["parameter", "arg"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLArgument", "/api-v17/type#graphqlargument"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>arg</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Value to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLArgument", "/api-v17/type#graphqlargument"]]} /></td>
<td>The value typed as a GraphQLArgument.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertArgument } from 'graphql/type';
const schema = buildSchema('type Query { greeting(name: String): String }');
const arg = assertArgument(schema.getQueryType().getFields().greeting.args[0]);
arg.name; // => 'name'
assertArgument(schema.getQueryType()); // throws an error
```
<hr className="api-item-divider" />
#### isInterfaceType()
Returns true when the value is a GraphQLInterfaceType.
**Signature:**
<ApiSignature parts={[["name", "isInterfaceType"], "(\n ", ["parameter", "type"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"]]} /></td>
<td>True when the value is a GraphQLInterfaceType.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { isInterfaceType } from 'graphql/type';
const schema = buildSchema(`
interface Node {
id: ID!
}
type User implements Node {
id: ID!
}
type Query {
node: Node
}
`);
isInterfaceType(schema.getType('Node')); // => true
isInterfaceType(schema.getType('User')); // => false
```
<hr className="api-item-divider" />
#### assertInterfaceType()
Returns the value as a GraphQLInterfaceType, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertInterfaceType"], "(", ["parameter", "type"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"]]} /></td>
<td>The value typed as a GraphQLInterfaceType.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertInterfaceType } from 'graphql/type';
const schema = buildSchema(`
interface Node {
id: ID!
}
type User implements Node {
id: ID!
}
type Query {
node: Node
}
`);
const nodeType = assertInterfaceType(schema.getType('Node'));
nodeType.name; // => 'Node'
assertInterfaceType(schema.getType('User')); // throws an error
```
<hr className="api-item-divider" />
#### isUnionType()
Returns true when the value is a GraphQLUnionType.
**Signature:**
<ApiSignature parts={[["name", "isUnionType"], "(\n ", ["parameter", "type"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLUnionType", "/api-v17/type#graphqluniontype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLUnionType", "/api-v17/type#graphqluniontype"]]} /></td>
<td>True when the value is a GraphQLUnionType.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { isUnionType } from 'graphql/type';
const schema = buildSchema(`
type Photo {
url: String!
}
type Video {
url: String!
}
union Media = Photo | Video
type Query {
media: [Media]
}
`);
isUnionType(schema.getType('Media')); // => true
isUnionType(schema.getType('Photo')); // => false
```
<hr className="api-item-divider" />
#### assertUnionType()
Returns the value as a GraphQLUnionType, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertUnionType"], "(", ["parameter", "type"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLUnionType", "/api-v17/type#graphqluniontype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLUnionType", "/api-v17/type#graphqluniontype"]]} /></td>
<td>The value typed as a GraphQLUnionType.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertUnionType } from 'graphql/type';
const schema = buildSchema(`
type Photo {
url: String!
}
type Video {
url: String!
}
union Media = Photo | Video
type Query {
media: [Media]
}
`);
const mediaType = assertUnionType(schema.getType('Media'));
mediaType.getTypes().map((type) => type.name); // => ['Photo', 'Video']
assertUnionType(schema.getType('Photo')); // throws an error
```
<hr className="api-item-divider" />
#### isEnumType()
Returns true when the value is a GraphQLEnumType.
**Signature:**
<ApiSignature parts={[["name", "isEnumType"], "(\n ", ["parameter", "type"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLEnumType", "/api-v17/type#graphqlenumtype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLEnumType", "/api-v17/type#graphqlenumtype"]]} /></td>
<td>True when the value is a GraphQLEnumType.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { isEnumType } from 'graphql/type';
const schema = buildSchema(`
enum Episode {
NEW_HOPE
EMPIRE
}
type Query {
favoriteEpisode: Episode
}
`);
isEnumType(schema.getType('Episode')); // => true
isEnumType(schema.getType('Query')); // => false
```
<hr className="api-item-divider" />
#### assertEnumType()
Returns the value as a GraphQLEnumType, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertEnumType"], "(", ["parameter", "type"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLEnumType", "/api-v17/type#graphqlenumtype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLEnumType", "/api-v17/type#graphqlenumtype"]]} /></td>
<td>The value typed as a GraphQLEnumType.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertEnumType } from 'graphql/type';
const schema = buildSchema(`
enum Episode {
NEW_HOPE
EMPIRE
}
type Query {
favoriteEpisode: Episode
}
`);
const episodeType = assertEnumType(schema.getType('Episode'));
episodeType.getValues().map((value) => value.name); // => ['NEW_HOPE', 'EMPIRE']
assertEnumType(schema.getType('Query')); // throws an error
```
<hr className="api-item-divider" />
#### isEnumValue()
Returns true when the value is a resolved GraphQL enum value definition.
**Signature:**
<ApiSignature parts={[["name", "isEnumValue"], "(\n ", ["parameter", "value"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "value"], " ", ["keyword", "is"], " ", ["link", "GraphQLEnumValue", "/api-v17/type#graphqlenumvalue"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>value</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Value to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "value"], " ", ["keyword", "is"], " ", ["link", "GraphQLEnumValue", "/api-v17/type#graphqlenumvalue"]]} /></td>
<td>True when the value is a GraphQLEnumValue.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertEnumType, isEnumValue } from 'graphql/type';
const schema = buildSchema('enum Episode { NEW_HOPE } type Query { episode: Episode }');
const enumValue = assertEnumType(schema.getType('Episode')).getValues()[0];
isEnumValue(enumValue); // => true
isEnumValue(schema.getType('Episode')); // => false
```
<hr className="api-item-divider" />
#### assertEnumValue()
Returns the value as a GraphQLEnumValue, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertEnumValue"], "(", ["parameter", "value"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLEnumValue", "/api-v17/type#graphqlenumvalue"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>value</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Value to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLEnumValue", "/api-v17/type#graphqlenumvalue"]]} /></td>
<td>The value typed as a GraphQLEnumValue.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertEnumType, assertEnumValue } from 'graphql/type';
const schema = buildSchema('enum Episode { NEW_HOPE } type Query { episode: Episode }');
const enumValue = assertEnumValue(
assertEnumType(schema.getType('Episode')).getValues()[0],
);
enumValue.name; // => 'NEW_HOPE'
assertEnumValue(schema.getType('Episode')); // throws an error
```
<hr className="api-item-divider" />
#### isInputObjectType()
Returns true when the value is a GraphQLInputObjectType.
**Signature:**
<ApiSignature parts={[["name", "isInputObjectType"], "(\n ", ["parameter", "type"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLInputObjectType", "/api-v17/type#graphqlinputobjecttype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLInputObjectType", "/api-v17/type#graphqlinputobjecttype"]]} /></td>
<td>True when the value is a GraphQLInputObjectType.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { isInputObjectType } from 'graphql/type';
const schema = buildSchema(`
input ReviewInput {
stars: Int!
}
type Review {
stars: Int!
}
type Query {
review(input: ReviewInput): Review
}
`);
isInputObjectType(schema.getType('ReviewInput')); // => true
isInputObjectType(schema.getType('Review')); // => false
```
<hr className="api-item-divider" />
#### assertInputObjectType()
Returns the value as a GraphQLInputObjectType, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertInputObjectType"], "(", ["parameter", "type"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLInputObjectType", "/api-v17/type#graphqlinputobjecttype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLInputObjectType", "/api-v17/type#graphqlinputobjecttype"]]} /></td>
<td>The value typed as a GraphQLInputObjectType.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertInputObjectType } from 'graphql/type';
const schema = buildSchema(`
input ReviewInput {
stars: Int!
}
type Review {
stars: Int!
}
type Query {
review(input: ReviewInput): Review
}
`);
const inputType = assertInputObjectType(schema.getType('ReviewInput'));
Object.keys(inputType.getFields()); // => ['stars']
assertInputObjectType(schema.getType('Review')); // throws an error
```
<hr className="api-item-divider" />
#### isInputField()
Returns true when the value is a resolved GraphQL input field definition.
**Signature:**
<ApiSignature parts={[["name", "isInputField"], "(\n ", ["parameter", "field"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "field"], " ", ["keyword", "is"], " ", ["link", "GraphQLInputField", "/api-v17/type#graphqlinputfield"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>field</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Value to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "field"], " ", ["keyword", "is"], " ", ["link", "GraphQLInputField", "/api-v17/type#graphqlinputfield"]]} /></td>
<td>True when the value is a GraphQLInputField.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertInputObjectType, isInputField } from 'graphql/type';
const schema = buildSchema('input ReviewInput { stars: Int } type Query { ok: Boolean }');
const inputField = assertInputObjectType(schema.getType('ReviewInput')).getFields().stars;
isInputField(inputField); // => true
isInputField(schema.getQueryType()); // => false
```
<hr className="api-item-divider" />
#### assertInputField()
Returns the value as a GraphQLInputField, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertInputField"], "(", ["parameter", "field"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLInputField", "/api-v17/type#graphqlinputfield"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>field</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Value to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLInputField", "/api-v17/type#graphqlinputfield"]]} /></td>
<td>The value typed as a GraphQLInputField.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertInputField, assertInputObjectType } from 'graphql/type';
const schema = buildSchema('input ReviewInput { stars: Int } type Query { ok: Boolean }');
const inputField = assertInputField(
assertInputObjectType(schema.getType('ReviewInput')).getFields().stars,
);
inputField.name; // => 'stars'
assertInputField(schema.getQueryType()); // throws an error
```
<hr className="api-item-divider" />
#### assertListType()
Returns the value as a GraphQLList, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertListType"], "(\n ", ["parameter", "type"], ": ", ["keyword", "unknown"], ",\n): ", ["link", "GraphQLList", "/api-v17/type#graphqllist"], "\u003c", ["link", "GraphQLType", "/api-v17/type#graphqltype"], "\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLList", "/api-v17/type#graphqllist"], "\u003c", ["link", "GraphQLType", "/api-v17/type#graphqltype"], "\u003e"]} /></td>
<td>The value typed as a GraphQLList.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLList, GraphQLString, assertListType } from 'graphql/type';
const listType = assertListType(new GraphQLList(GraphQLString));
listType.ofType; // => GraphQLString
assertListType(GraphQLString); // throws an error
```
<hr className="api-item-divider" />
#### assertNonNullType()
Returns the value as a GraphQLNonNull, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertNonNullType"], "(\n ", ["parameter", "type"], ": ", ["keyword", "unknown"], ",\n): ", ["link", "GraphQLNonNull", "/api-v17/type#graphqlnonnull"], "\u003c", ["link", "GraphQLNullableType", "/api-v17/type#graphqlnullabletype"], "\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLNonNull", "/api-v17/type#graphqlnonnull"], "\u003c", ["link", "GraphQLNullableType", "/api-v17/type#graphqlnullabletype"], "\u003e"]} /></td>
<td>The value typed as a GraphQLNonNull.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLNonNull, GraphQLString, assertNonNullType } from 'graphql/type';
const nonNullType = assertNonNullType(new GraphQLNonNull(GraphQLString));
nonNullType.ofType; // => GraphQLString
assertNonNullType(GraphQLString); // throws an error
```
<hr className="api-item-divider" />
#### isInputType()
Returns true when the value can be used as a GraphQL input type.
**Signature:**
<ApiSignature parts={[["name", "isInputType"], "(\n ", ["parameter", "type"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLInputType", "/api-v17/type#graphqlinputtype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLInputType", "/api-v17/type#graphqlinputtype"]]} /></td>
<td>True when the value can be used as a GraphQL input type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { isInputType } from 'graphql/type';
const schema = buildSchema(`
input ReviewInput {
stars: Int!
}
type Review {
stars: Int!
}
type Query {
review(input: ReviewInput): Review
}
`);
isInputType(schema.getType('ReviewInput')); // => true
isInputType(schema.getType('Review')); // => false
```
<hr className="api-item-divider" />
#### assertInputType()
Returns the value as a GraphQL input type, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertInputType"], "(", ["parameter", "type"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLInputType", "/api-v17/type#graphqlinputtype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLInputType", "/api-v17/type#graphqlinputtype"]]} /></td>
<td>The value typed as a GraphQL input type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertInputType } from 'graphql/type';
const schema = buildSchema(`
input ReviewInput {
stars: Int!
}
type Review {
stars: Int!
}
type Query {
review(input: ReviewInput): Review
}
`);
const inputType = assertInputType(schema.getType('ReviewInput'));
inputType.toString(); // => 'ReviewInput'
assertInputType(schema.getType('Review')); // throws an error
```
<hr className="api-item-divider" />
#### isOutputType()
Returns true when the value can be used as a GraphQL output type.
**Signature:**
<ApiSignature parts={[["name", "isOutputType"], "(\n ", ["parameter", "type"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLOutputType", "/api-v17/type#graphqloutputtype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLOutputType", "/api-v17/type#graphqloutputtype"]]} /></td>
<td>True when the value can be used as a GraphQL output type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { isOutputType } from 'graphql/type';
const schema = buildSchema(`
input ReviewInput {
stars: Int!
}
type Review {
stars: Int!
}
type Query {
review(input: ReviewInput): Review
}
`);
isOutputType(schema.getType('Review')); // => true
isOutputType(schema.getType('ReviewInput')); // => false
```
<hr className="api-item-divider" />
#### assertOutputType()
Returns the value as a GraphQL output type, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertOutputType"], "(", ["parameter", "type"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLOutputType", "/api-v17/type#graphqloutputtype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLOutputType", "/api-v17/type#graphqloutputtype"]]} /></td>
<td>The value typed as a GraphQL output type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertOutputType } from 'graphql/type';
const schema = buildSchema(`
input ReviewInput {
stars: Int!
}
type Review {
stars: Int!
}
type Query {
review(input: ReviewInput): Review
}
`);
const outputType = assertOutputType(schema.getType('Review'));
outputType.toString(); // => 'Review'
assertOutputType(schema.getType('ReviewInput')); // throws an error
```
<hr className="api-item-divider" />
#### isLeafType()
Returns true when the value is a GraphQL scalar or enum type.
**Signature:**
<ApiSignature parts={[["name", "isLeafType"], "(\n ", ["parameter", "type"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLLeafType", "/api-v17/type#graphqlleaftype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLLeafType", "/api-v17/type#graphqlleaftype"]]} /></td>
<td>True when the value is a GraphQL scalar or enum type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { isLeafType } from 'graphql/type';
const schema = buildSchema(`
enum Episode {
NEW_HOPE
}
type Review {
stars: Int!
}
type Query {
episode: Episode
review: Review
}
`);
isLeafType(schema.getType('Episode')); // => true
isLeafType(schema.getType('String')); // => true
isLeafType(schema.getType('Review')); // => false
```
<hr className="api-item-divider" />
#### assertLeafType()
Returns the value as a GraphQL leaf type, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertLeafType"], "(", ["parameter", "type"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLLeafType", "/api-v17/type#graphqlleaftype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLLeafType", "/api-v17/type#graphqlleaftype"]]} /></td>
<td>The value typed as a GraphQL leaf type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertLeafType } from 'graphql/type';
const schema = buildSchema(`
enum Episode {
NEW_HOPE
}
type Review {
stars: Int!
}
type Query {
episode: Episode
review: Review
}
`);
const episodeType = assertLeafType(schema.getType('Episode'));
episodeType.toString(); // => 'Episode'
assertLeafType(schema.getType('Review')); // throws an error
```
<hr className="api-item-divider" />
#### isCompositeType()
Returns true when the value is a GraphQL object, interface, or union type.
**Signature:**
<ApiSignature parts={[["name", "isCompositeType"], "(\n ", ["parameter", "type"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLCompositeType", "/api-v17/type#graphqlcompositetype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLCompositeType", "/api-v17/type#graphqlcompositetype"]]} /></td>
<td>True when the value is a GraphQL object, interface, or union type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { isCompositeType } from 'graphql/type';
const schema = buildSchema(`
interface Node {
id: ID!
}
type User implements Node {
id: ID!
}
union SearchResult = User
type Query {
node: Node
search: [SearchResult]
}
`);
isCompositeType(schema.getType('User')); // => true
isCompositeType(schema.getType('Node')); // => true
isCompositeType(schema.getType('SearchResult')); // => true
isCompositeType(schema.getType('String')); // => false
```
<hr className="api-item-divider" />
#### assertCompositeType()
Returns the value as a GraphQL composite type, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertCompositeType"], "(", ["parameter", "type"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLCompositeType", "/api-v17/type#graphqlcompositetype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLCompositeType", "/api-v17/type#graphqlcompositetype"]]} /></td>
<td>The value typed as a GraphQL composite type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertCompositeType } from 'graphql/type';
const schema = buildSchema(`
interface Node {
id: ID!
}
type User implements Node {
id: ID!
}
type Query {
node: Node
}
`);
const userType = assertCompositeType(schema.getType('User'));
userType.toString(); // => 'User'
assertCompositeType(schema.getType('String')); // throws an error
```
<hr className="api-item-divider" />
#### isAbstractType()
Returns true when the value is a GraphQL interface or union type.
**Signature:**
<ApiSignature parts={[["name", "isAbstractType"], "(\n ", ["parameter", "type"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLAbstractType", "/api-v17/type#graphqlabstracttype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLAbstractType", "/api-v17/type#graphqlabstracttype"]]} /></td>
<td>True when the value is a GraphQL interface or union type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { isAbstractType } from 'graphql/type';
const schema = buildSchema(`
interface Node {
id: ID!
}
type User implements Node {
id: ID!
}
union SearchResult = User
type Query {
node: Node
search: [SearchResult]
}
`);
isAbstractType(schema.getType('Node')); // => true
isAbstractType(schema.getType('SearchResult')); // => true
isAbstractType(schema.getType('User')); // => false
```
<hr className="api-item-divider" />
#### assertAbstractType()
Returns the value as a GraphQL abstract type, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertAbstractType"], "(", ["parameter", "type"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLAbstractType", "/api-v17/type#graphqlabstracttype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLAbstractType", "/api-v17/type#graphqlabstracttype"]]} /></td>
<td>The value typed as a GraphQL abstract type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertAbstractType } from 'graphql/type';
const schema = buildSchema(`
interface Node {
id: ID!
}
type User implements Node {
id: ID!
}
type Query {
node: Node
}
`);
const nodeType = assertAbstractType(schema.getType('Node'));
nodeType.toString(); // => 'Node'
assertAbstractType(schema.getType('User')); // throws an error
```
<hr className="api-item-divider" />
#### isWrappingType()
Returns true when the value is a GraphQL list or non-null wrapper type.
**Signature:**
<ApiSignature parts={[["name", "isWrappingType"], "(\n ", ["parameter", "type"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLWrappingType", "/api-v17/type#graphqlwrappingtype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLWrappingType", "/api-v17/type#graphqlwrappingtype"]]} /></td>
<td>True when the value is a GraphQL list or non-null wrapper type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import {
GraphQLList,
GraphQLNonNull,
GraphQLString,
isWrappingType,
} from 'graphql/type';
isWrappingType(new GraphQLList(GraphQLString)); // => true
isWrappingType(new GraphQLNonNull(GraphQLString)); // => true
isWrappingType(GraphQLString); // => false
```
<hr className="api-item-divider" />
#### assertWrappingType()
Returns the value as a GraphQL wrapping type, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertWrappingType"], "(", ["parameter", "type"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLWrappingType", "/api-v17/type#graphqlwrappingtype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLWrappingType", "/api-v17/type#graphqlwrappingtype"]]} /></td>
<td>The value typed as a GraphQL wrapping type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLList, GraphQLString, assertWrappingType } from 'graphql/type';
const wrappingType = assertWrappingType(new GraphQLList(GraphQLString));
wrappingType.toString(); // => '[String]'
assertWrappingType(GraphQLString); // throws an error
```
<hr className="api-item-divider" />
#### isNullableType()
Returns true when the value is a GraphQL type that can accept null.
**Signature:**
<ApiSignature parts={[["name", "isNullableType"], "(\n ", ["parameter", "type"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLNullableType", "/api-v17/type#graphqlnullabletype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLNullableType", "/api-v17/type#graphqlnullabletype"]]} /></td>
<td>True when the value is a GraphQL type that can accept null.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLNonNull, GraphQLString, isNullableType } from 'graphql/type';
isNullableType(GraphQLString); // => true
isNullableType(new GraphQLNonNull(GraphQLString)); // => false
isNullableType(null); // => false
```
<hr className="api-item-divider" />
#### assertNullableType()
Returns the value as a nullable GraphQL type, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertNullableType"], "(", ["parameter", "type"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLNullableType", "/api-v17/type#graphqlnullabletype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLNullableType", "/api-v17/type#graphqlnullabletype"]]} /></td>
<td>The value typed as a nullable GraphQL type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import {
GraphQLNonNull,
GraphQLString,
assertNullableType,
} from 'graphql/type';
const nullableType = assertNullableType(GraphQLString);
nullableType; // => GraphQLString
assertNullableType(new GraphQLNonNull(GraphQLString)); // throws an error
```
<hr className="api-item-divider" />
#### isNamedType()
Returns true when the value is a GraphQL named type.
**Signature:**
<ApiSignature parts={[["name", "isNamedType"], "(\n ", ["parameter", "type"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLNamedType", "/api-v17/type#graphqlnamedtype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "type"], " ", ["keyword", "is"], " ", ["link", "GraphQLNamedType", "/api-v17/type#graphqlnamedtype"]]} /></td>
<td>True when the value is a GraphQL named type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLList, GraphQLString, isNamedType } from 'graphql/type';
isNamedType(GraphQLString); // => true
isNamedType(new GraphQLList(GraphQLString)); // => false
isNamedType(null); // => false
```
<hr className="api-item-divider" />
#### assertNamedType()
Returns the value as a GraphQL named type, or throws if it is not one.
**Signature:**
<ApiSignature parts={[["name", "assertNamedType"], "(", ["parameter", "type"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLNamedType", "/api-v17/type#graphqlnamedtype"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLNamedType", "/api-v17/type#graphqlnamedtype"]]} /></td>
<td>The value typed as a GraphQL named type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLList, GraphQLString, assertNamedType } from 'graphql/type';
const namedType = assertNamedType(GraphQLString);
namedType.name; // => 'String'
assertNamedType(new GraphQLList(GraphQLString)); // throws an error
```
<hr className="api-item-divider" />
#### resolveReadonlyArrayThunk()
Resolves a thunked readonly array.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>T</td>
<td></td>
<td></td>
<td>The element type resolved from the thunk or array.</td>
</tr>
</tbody>
</table>
**Signature:**
<ApiSignature parts={[["name", "resolveReadonlyArrayThunk"], "\u003c", ["type", "T"], "\u003e(\n ", ["parameter", "thunk"], ": ", ["link", "ThunkReadonlyArray", "/api-v17/type#thunkreadonlyarray"], "\u003c", ["type", "T"], "\u003e,\n): ", ["keyword", "readonly"], " ", ["type", "T"], "[];"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>thunk</td>
<td><ApiType parts={[["link", "ThunkReadonlyArray", "/api-v17/type#thunkreadonlyarray"], "\u003c", ["type", "T"], "\u003e"]} /></td>
<td>The thunk or value to resolve.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "readonly"], " ", ["type", "T"], "[]"]} /></td>
<td>The resolved readonly array.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLString, resolveReadonlyArrayThunk } from 'graphql/type';
const lazyFields = resolveReadonlyArrayThunk(() => [GraphQLString]);
const fields = resolveReadonlyArrayThunk([GraphQLString]);
lazyFields; // => [GraphQLString]
fields; // => [GraphQLString]
```
<hr className="api-item-divider" />
#### resolveObjMapThunk()
Resolves a thunked object map.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>T</td>
<td></td>
<td></td>
<td>The object-map value type resolved from the thunk or map.</td>
</tr>
</tbody>
</table>
**Signature:**
<ApiSignature parts={[["name", "resolveObjMapThunk"], "\u003c", ["type", "T"], "\u003e(\n ", ["parameter", "thunk"], ": ", ["link", "ThunkObjMap", "/api-v17/type#thunkobjmap"], "\u003c", ["type", "T"], "\u003e,\n): ", ["type", "ObjMap"], "\u003c", ["type", "T"], "\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>thunk</td>
<td><ApiType parts={[["link", "ThunkObjMap", "/api-v17/type#thunkobjmap"], "\u003c", ["type", "T"], "\u003e"]} /></td>
<td>The thunk or value to resolve.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "ObjMap"], "\u003c", ["type", "T"], "\u003e"]} /></td>
<td>The resolved object map.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLString, resolveObjMapThunk } from 'graphql/type';
const lazyFields = resolveObjMapThunk(() => ({ name: GraphQLString }));
const fields = resolveObjMapThunk({ name: GraphQLString });
lazyFields.name; // => GraphQLString
fields.name; // => GraphQLString
```
<hr className="api-item-divider" />
#### isRequiredArgument()
Returns true when the argument is non-null and has no default value.
**Signature:**
<ApiSignature parts={[["name", "isRequiredArgument"], "(\n ", ["parameter", "arg"], ": ", ["link", "GraphQLArgument", "/api-v17/type#graphqlargument"], " \u007c ", ["type", "GraphQLVariableSignature"], ",\n): ", ["keyword", "boolean"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>arg</td>
<td><ApiType parts={[["link", "GraphQLArgument", "/api-v17/type#graphqlargument"], " \u007c ", ["type", "GraphQLVariableSignature"]]} /></td>
<td>The argument definition to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "boolean"]]} /></td>
<td>True when the argument is non-null and has no default value.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import {
GraphQLArgument,
GraphQLField,
GraphQLInt,
GraphQLNonNull,
GraphQLObjectType,
GraphQLString,
isRequiredArgument,
} from 'graphql/type';
const Query = new GraphQLObjectType({ name: 'Query', fields: {} });
const field = new GraphQLField(Query, 'reviews', { type: GraphQLString });
const requiredArgument = new GraphQLArgument(field, 'id', {
type: new GraphQLNonNull(GraphQLInt),
});
const optionalArgument = new GraphQLArgument(field, 'name', {
type: GraphQLString,
});
const argumentWithDefault = new GraphQLArgument(field, 'limit', {
type: new GraphQLNonNull(GraphQLInt),
default: { value: 10 },
});
isRequiredArgument(requiredArgument); // => true
isRequiredArgument(optionalArgument); // => false
isRequiredArgument(argumentWithDefault); // => false
```
<hr className="api-item-divider" />
#### isRequiredInputField()
Returns true when the input field is non-null and has no default value.
**Signature:**
<ApiSignature parts={[["name", "isRequiredInputField"], "(", ["parameter", "field"], ": ", ["link", "GraphQLInputField", "/api-v17/type#graphqlinputfield"], "): ", ["keyword", "boolean"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>field</td>
<td><ApiType parts={[["link", "GraphQLInputField", "/api-v17/type#graphqlinputfield"]]} /></td>
<td>The input field definition to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "boolean"]]} /></td>
<td>True when the input field is non-null and has no default value.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import {
GraphQLInputField,
GraphQLInputObjectType,
GraphQLInt,
GraphQLNonNull,
GraphQLString,
isRequiredInputField,
} from 'graphql/type';
const ReviewInput = new GraphQLInputObjectType({
name: 'ReviewInput',
fields: {},
});
const requiredField = new GraphQLInputField(ReviewInput, 'id', {
type: new GraphQLNonNull(GraphQLInt),
});
const optionalField = new GraphQLInputField(ReviewInput, 'name', {
type: GraphQLString,
});
const fieldWithDefault = new GraphQLInputField(ReviewInput, 'limit', {
type: new GraphQLNonNull(GraphQLInt),
default: { value: 10 },
});
isRequiredInputField(requiredField); // => true
isRequiredInputField(optionalField); // => false
isRequiredInputField(fieldWithDefault); // => false
```
### Types
#### GraphQLType
**Type alias.** These are all of the possible kinds of types.
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLType"], " = ", ["link", "GraphQLNamedType", "/api-v17/type#graphqlnamedtype"], " \u007c ", ["link", "GraphQLWrappingType", "/api-v17/type#graphqlwrappingtype"], ";"]} />
<hr className="api-item-divider" />
#### GraphQLNullableInputType
**Type alias.** These types may be used as input types for arguments and directives.
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLNullableInputType"], " =\n \u007c ", ["link", "GraphQLNamedInputType", "/api-v17/type#graphqlnamedinputtype"], "\n \u007c ", ["link", "GraphQLList", "/api-v17/type#graphqllist"], "\u003c", ["link", "GraphQLInputType", "/api-v17/type#graphqlinputtype"], "\u003e;"]} />
<hr className="api-item-divider" />
#### GraphQLInputType
**Type alias.** These types may be used as input types for arguments and directives.
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLInputType"], " =\n \u007c ", ["link", "GraphQLNullableInputType", "/api-v17/type#graphqlnullableinputtype"], "\n \u007c ", ["link", "GraphQLNonNull", "/api-v17/type#graphqlnonnull"], "\u003c", ["link", "GraphQLNullableInputType", "/api-v17/type#graphqlnullableinputtype"], "\u003e;"]} />
<hr className="api-item-divider" />
#### GraphQLNullableOutputType
**Type alias.** These types may be used as output types as the result of fields.
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLNullableOutputType"], " =\n \u007c ", ["link", "GraphQLNamedOutputType", "/api-v17/type#graphqlnamedoutputtype"], "\n \u007c ", ["link", "GraphQLList", "/api-v17/type#graphqllist"], "\u003c", ["link", "GraphQLOutputType", "/api-v17/type#graphqloutputtype"], "\u003e;"]} />
<hr className="api-item-divider" />
#### GraphQLOutputType
**Type alias.** These types may be used as output types as the result of fields.
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLOutputType"], " =\n \u007c ", ["link", "GraphQLNullableOutputType", "/api-v17/type#graphqlnullableoutputtype"], "\n \u007c ", ["link", "GraphQLNonNull", "/api-v17/type#graphqlnonnull"], "\u003c", ["link", "GraphQLNullableOutputType", "/api-v17/type#graphqlnullableoutputtype"], "\u003e;"]} />
<hr className="api-item-divider" />
#### GraphQLLeafType
**Type alias.** These types may describe types which may be leaf values.
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLLeafType"], " = ", ["link", "GraphQLScalarType", "/api-v17/type#graphqlscalartype"], " \u007c ", ["link", "GraphQLEnumType", "/api-v17/type#graphqlenumtype"], ";"]} />
<hr className="api-item-divider" />
#### GraphQLCompositeType
**Type alias.** These types may describe the parent context of a selection set.
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLCompositeType"], " =\n \u007c ", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "\n \u007c ", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"], "\n \u007c ", ["link", "GraphQLUnionType", "/api-v17/type#graphqluniontype"], ";"]} />
<hr className="api-item-divider" />
#### GraphQLAbstractType
**Type alias.** These types may describe the parent context of a selection set.
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLAbstractType"], " = ", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"], " \u007c ", ["link", "GraphQLUnionType", "/api-v17/type#graphqluniontype"], ";"]} />
<hr className="api-item-divider" />
#### GraphQLWrappingType
**Type alias.** These types wrap and modify other types
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLWrappingType"], " =\n \u007c ", ["link", "GraphQLList", "/api-v17/type#graphqllist"], "\u003c", ["link", "GraphQLType", "/api-v17/type#graphqltype"], "\u003e\n \u007c ", ["link", "GraphQLNonNull", "/api-v17/type#graphqlnonnull"], "\u003c", ["link", "GraphQLNullableType", "/api-v17/type#graphqlnullabletype"], "\u003e;"]} />
<hr className="api-item-divider" />
#### GraphQLNullableType
**Type alias.** These types can all accept null as a value.
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLNullableType"], " =\n \u007c ", ["link", "GraphQLNamedType", "/api-v17/type#graphqlnamedtype"], "\n \u007c ", ["link", "GraphQLList", "/api-v17/type#graphqllist"], "\u003c", ["link", "GraphQLType", "/api-v17/type#graphqltype"], "\u003e;"]} />
<hr className="api-item-divider" />
#### GraphQLNamedType
**Type alias.** These named types do not include modifiers like List or NonNull.
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLNamedType"], " = ", ["link", "GraphQLNamedInputType", "/api-v17/type#graphqlnamedinputtype"], " \u007c ", ["link", "GraphQLNamedOutputType", "/api-v17/type#graphqlnamedoutputtype"], ";"]} />
<hr className="api-item-divider" />
#### GraphQLNamedInputType
**Type alias.** A named GraphQL type that can be used as an input type.
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLNamedInputType"], " =\n \u007c ", ["link", "GraphQLScalarType", "/api-v17/type#graphqlscalartype"], "\n \u007c ", ["link", "GraphQLEnumType", "/api-v17/type#graphqlenumtype"], "\n \u007c ", ["link", "GraphQLInputObjectType", "/api-v17/type#graphqlinputobjecttype"], ";"]} />
<hr className="api-item-divider" />
#### GraphQLNamedOutputType
**Type alias.** A named GraphQL type that can be used as an output type.
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLNamedOutputType"], " =\n \u007c ", ["link", "GraphQLScalarType", "/api-v17/type#graphqlscalartype"], "\n \u007c ", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "\n \u007c ", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"], "\n \u007c ", ["link", "GraphQLUnionType", "/api-v17/type#graphqluniontype"], "\n \u007c ", ["link", "GraphQLEnumType", "/api-v17/type#graphqlenumtype"], ";"]} />
<hr className="api-item-divider" />
#### ThunkReadonlyArray
**Type alias.** Used while defining GraphQL types to allow for circular references in
otherwise immutable type definitions.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>T</td>
<td></td>
<td></td>
<td>The element type returned by the thunk or array.</td>
</tr>
</tbody>
</table>
<ApiSignature parts={[["keyword", "type"], " ", ["name", "ThunkReadonlyArray"], "\u003c", ["type", "T"], "\u003e =\n \u007c (() =\u003e ", ["type", "ReadonlyArray"], "\u003c", ["type", "T"], "\u003e)\n \u007c ", ["type", "ReadonlyArray"], "\u003c", ["type", "T"], "\u003e;"]} />
<hr className="api-item-divider" />
#### ThunkObjMap
**Type alias.** A thunk that resolves to an object map.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>T</td>
<td></td>
<td></td>
<td>Value type stored in the object map.</td>
</tr>
</tbody>
</table>
<ApiSignature parts={[["keyword", "type"], " ", ["name", "ThunkObjMap"], "\u003c", ["type", "T"], "\u003e =\n \u007c (() =\u003e ", ["type", "ObjMap"], "\u003c", ["type", "T"], "\u003e)\n \u007c ", ["type", "ObjMap"], "\u003c", ["type", "T"], "\u003e;"]} />
<hr className="api-item-divider" />
#### GraphQLScalarTypeExtensions
**Interface.** Custom extensions
**Remarks:** Use a unique identifier name for your extension, for example the name of
your library or project. Do not use a shortened identifier as this increases
the risk of conflicts. We recommend you add at most one extension field,
an object which can contain all the values you need.
<hr className="api-item-divider" />
#### GraphQLScalarSerializer <span aria-label="Deprecated" className="api-tag" title="Deprecated">Deprecated</span>
**Type alias.** Deprecated function type that serializes a runtime value as a scalar output
value. Use [`GraphQLScalarOutputValueCoercer`](/api-v17/type#graphqlscalaroutputvaluecoercer) instead.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TExternal</td>
<td></td>
<td></td>
<td>External representation accepted from or returned to callers.</td>
</tr>
</tbody>
</table>
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLScalarSerializer"], "\u003c", ["type", "TExternal"], "\u003e = (\n ", ["parameter", "outputValue"], ": ", ["keyword", "unknown"], ",\n) =\u003e ", ["type", "TExternal"], ";"]} />
<hr className="api-item-divider" />
#### GraphQLScalarOutputValueCoercer
**Type alias.** Function used to coerce internal scalar values for response output.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TExternal</td>
<td></td>
<td></td>
<td>External representation accepted from or returned to callers.</td>
</tr>
</tbody>
</table>
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLScalarOutputValueCoercer"], "\u003c", ["type", "TExternal"], "\u003e = (\n ", ["parameter", "outputValue"], ": ", ["keyword", "unknown"], ",\n) =\u003e ", ["type", "TExternal"], ";"]} />
<hr className="api-item-divider" />
#### GraphQLScalarValueParser <span aria-label="Deprecated" className="api-tag" title="Deprecated">Deprecated</span>
**Type alias.** Deprecated function type that parses a runtime input value as a scalar input
value. Use [`GraphQLScalarInputValueCoercer`](/api-v17/type#graphqlscalarinputvaluecoercer) instead.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TInternal</td>
<td></td>
<td></td>
<td>Internal runtime representation for this scalar.</td>
</tr>
</tbody>
</table>
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLScalarValueParser"], "\u003c", ["type", "TInternal"], "\u003e = (\n ", ["parameter", "inputValue"], ": ", ["keyword", "unknown"], ",\n) =\u003e ", ["type", "TInternal"], ";"]} />
<hr className="api-item-divider" />
#### GraphQLScalarInputValueCoercer
**Type alias.** Function used to coerce externally provided scalar input values.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TInternal</td>
<td></td>
<td></td>
<td>Internal runtime representation for this scalar.</td>
</tr>
</tbody>
</table>
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLScalarInputValueCoercer"], "\u003c", ["type", "TInternal"], "\u003e = (\n ", ["parameter", "inputValue"], ": ", ["keyword", "unknown"], ",\n) =\u003e ", ["type", "TInternal"], ";"]} />
<hr className="api-item-divider" />
#### GraphQLScalarLiteralParser <span aria-label="Deprecated" className="api-tag" title="Deprecated">Deprecated</span>
**Type alias.** Deprecated function type that parses a GraphQL value literal as a scalar
input value. Use [`GraphQLScalarInputLiteralCoercer`](/api-v17/type#graphqlscalarinputliteralcoercer) instead.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TInternal</td>
<td></td>
<td></td>
<td>Internal runtime representation for this scalar.</td>
</tr>
</tbody>
</table>
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLScalarLiteralParser"], "\u003c", ["type", "TInternal"], "\u003e = (\n ", ["parameter", "valueNode"], ": ", ["link", "ValueNode", "/api-v17/language#valuenode"], ",\n ", ["parameter", "variables"], ": ", ["type", "Maybe"], "\u003c", ["type", "ObjMap"], "\u003c", ["keyword", "unknown"], "\u003e\u003e,\n) =\u003e ", ["type", "Maybe"], "\u003c", ["type", "TInternal"], "\u003e;"]} />
<hr className="api-item-divider" />
#### GraphQLScalarInputLiteralCoercer
**Type alias.** Function used to coerce GraphQL scalar input literals.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TInternal</td>
<td></td>
<td></td>
<td>Internal runtime representation for this scalar.</td>
</tr>
</tbody>
</table>
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLScalarInputLiteralCoercer"], "\u003c", ["type", "TInternal"], "\u003e = (\n ", ["parameter", "valueNode"], ": ", ["link", "ConstValueNode", "/api-v17/language#constvaluenode"], ",\n) =\u003e ", ["type", "Maybe"], "\u003c", ["type", "TInternal"], "\u003e;"]} />
<hr className="api-item-divider" />
#### GraphQLScalarTypeConfig
**Interface.** Configuration used to construct a GraphQLScalarType.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TInternal</td>
<td></td>
<td></td>
<td>Internal runtime representation for this scalar.</td>
</tr>
<tr>
<td>TExternal</td>
<td></td>
<td></td>
<td>External representation accepted from or returned to callers.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>specifiedByURL?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>URL identifying the behavior specified for this custom scalar.</td>
</tr>
<tr>
<td>serialize?</td>
<td><ApiType parts={[["link", "GraphQLScalarSerializer", "/api-v17/type#graphqlscalarserializer"], "\u003c", ["type", "TExternal"], "\u003e"]} /></td>
<td>Deprecated legacy serializer used to convert internal values for response<br />
output. Use <code>{"coerceOutputValue()"}</code> instead.</td>
</tr>
<tr>
<td>parseValue?</td>
<td><ApiType parts={[["link", "GraphQLScalarValueParser", "/api-v17/type#graphqlscalarvalueparser"], "\u003c", ["type", "TInternal"], "\u003e"]} /></td>
<td>Deprecated legacy parser used to convert externally provided input values.<br />
Use <code>{"coerceInputValue()"}</code> instead.</td>
</tr>
<tr>
<td>parseLiteral?</td>
<td><ApiType parts={[["link", "GraphQLScalarLiteralParser", "/api-v17/type#graphqlscalarliteralparser"], "\u003c", ["type", "TInternal"], "\u003e"]} /></td>
<td>Deprecated legacy parser used to convert externally provided input<br />
literals. Use <code>{"replaceVariables()"}</code> and <code>{"coerceInputLiteral()"}</code> instead.</td>
</tr>
<tr>
<td>coerceOutputValue?</td>
<td><ApiType parts={[["link", "GraphQLScalarOutputValueCoercer", "/api-v17/type#graphqlscalaroutputvaluecoercer"], "\u003c", ["type", "TExternal"], "\u003e"]} /></td>
<td>Coerces an internal value to include in a response.</td>
</tr>
<tr>
<td>coerceInputValue?</td>
<td><ApiType parts={[["link", "GraphQLScalarInputValueCoercer", "/api-v17/type#graphqlscalarinputvaluecoercer"], "\u003c", ["type", "TInternal"], "\u003e"]} /></td>
<td>Coerces an externally provided value to use as an input.</td>
</tr>
<tr>
<td>coerceInputLiteral?</td>
<td><ApiType parts={[["link", "GraphQLScalarInputLiteralCoercer", "/api-v17/type#graphqlscalarinputliteralcoercer"], "\u003c", ["type", "TInternal"], "\u003e"]} /></td>
<td>Coerces an externally provided const literal value to use as an input.</td>
</tr>
<tr>
<td>valueToLiteral?</td>
<td><ApiType parts={[["type", "GraphQLScalarValueToLiteral"]]} /></td>
<td>Translates an externally provided value to a literal (AST).</td>
</tr>
<tr>
<td>extensions?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["type", "Readonly"], "\u003c", ["link", "GraphQLScalarTypeExtensions", "/api-v17/type#graphqlscalartypeextensions"], "\u003e\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "ScalarTypeDefinitionNode", "/api-v17/language#scalartypedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
<tr>
<td>extensionASTNodes?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "readonly"], " ", ["link", "ScalarTypeExtensionNode", "/api-v17/language#scalartypeextensionnode"], "[]\u003e"]} /></td>
<td>AST extension nodes applied to this schema element.</td>
</tr>
</tbody>
</table>
<hr className="api-item-divider" />
#### GraphQLObjectTypeExtensions
**Interface.** Custom extensions
**Remarks:** Use a unique identifier name for your extension, for example the name of
your library or project. Do not use a shortened identifier as this increases
the risk of conflicts. We recommend you add at most one extension field,
an object which can contain all the values you need.
We've provided these template arguments because this is an open type and
you may find them useful.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>_TSource</td>
<td></td>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>Reserved source type parameter for extension typing.</td>
</tr>
<tr>
<td>_TContext</td>
<td></td>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>Reserved context type parameter for extension typing.</td>
</tr>
</tbody>
</table>
<hr className="api-item-divider" />
#### GraphQLObjectTypeConfig
**Interface.** Configuration used to construct a GraphQLObjectType.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TSource</td>
<td></td>
<td></td>
<td>Source object type passed to resolvers.</td>
</tr>
<tr>
<td>TContext</td>
<td></td>
<td></td>
<td>Context object type passed to resolvers.</td>
</tr>
<tr>
<td>TAbstract</td>
<td></td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Runtime value type used for abstract type resolution.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>interfaces?</td>
<td><ApiType parts={[["link", "ThunkReadonlyArray", "/api-v17/type#thunkreadonlyarray"], "\u003c", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"], "\u003e"]} /></td>
<td>Interfaces implemented by this object or interface type.</td>
</tr>
<tr>
<td>fields</td>
<td><ApiType parts={[["link", "ThunkObjMap", "/api-v17/type#thunkobjmap"], "\u003c\n ", ["link", "GraphQLFieldConfig", "/api-v17/type#graphqlfieldconfig"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e\n\u003e"]} /></td>
<td>Fields declared by this object, interface, input object, or literal.</td>
</tr>
<tr>
<td>isTypeOf?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c\n ", ["link", "GraphQLIsTypeOfFn", "/api-v17/type#graphqlistypeoffn"], "\u003c", ["type", "TAbstract"], ", ", ["type", "TContext"], "\u003e\n\u003e"]} /></td>
<td>Predicate used to determine whether a runtime value belongs to this object type.</td>
</tr>
<tr>
<td>extensions?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c\n ", ["type", "Readonly"], "\u003c\n ", ["link", "GraphQLObjectTypeExtensions", "/api-v17/type#graphqlobjecttypeextensions"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e\n \u003e\n\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "ObjectTypeDefinitionNode", "/api-v17/language#objecttypedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
<tr>
<td>extensionASTNodes?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "readonly"], " ", ["link", "ObjectTypeExtensionNode", "/api-v17/language#objecttypeextensionnode"], "[]\u003e"]} /></td>
<td>AST extension nodes applied to this schema element.</td>
</tr>
</tbody>
</table>
<hr className="api-item-divider" />
#### GraphQLTypeResolver
**Type alias.** Resolves the concrete object type for an abstract GraphQL type.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TSource</td>
<td></td>
<td></td>
<td>Source object type passed to resolvers.</td>
</tr>
<tr>
<td>TContext</td>
<td></td>
<td></td>
<td>Context object type passed to resolvers.</td>
</tr>
</tbody>
</table>
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLTypeResolver"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e = (\n ", ["parameter", "value"], ": ", ["type", "TSource"], ",\n ", ["parameter", "context"], ": ", ["type", "TContext"], ",\n ", ["parameter", "info"], ": ", ["link", "GraphQLResolveInfo", "/api-v17/type#graphqlresolveinfo"], ",\n ", ["parameter", "abstractType"], ": ", ["link", "GraphQLAbstractType", "/api-v17/type#graphqlabstracttype"], ",\n) =\u003e ", ["type", "PromiseOrValue"], "\u003c", ["keyword", "string"], " \u007c ", ["keyword", "undefined"], "\u003e;"]} />
<hr className="api-item-divider" />
#### GraphQLIsTypeOfFn
**Type alias.** Checks whether a runtime value belongs to a GraphQL object type.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TAbstract</td>
<td></td>
<td></td>
<td>Runtime value type used for abstract type resolution.</td>
</tr>
<tr>
<td>TContext</td>
<td></td>
<td></td>
<td>Context object type passed to resolvers.</td>
</tr>
</tbody>
</table>
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLIsTypeOfFn"], "\u003c", ["type", "TAbstract"], ", ", ["type", "TContext"], "\u003e = (\n ", ["parameter", "value"], ": ", ["type", "TAbstract"], ",\n ", ["parameter", "context"], ": ", ["type", "TContext"], ",\n ", ["parameter", "info"], ": ", ["link", "GraphQLResolveInfo", "/api-v17/type#graphqlresolveinfo"], ",\n) =\u003e ", ["type", "PromiseOrValue"], "\u003c", ["keyword", "boolean"], "\u003e;"]} />
<hr className="api-item-divider" />
#### GraphQLFieldResolver
**Type alias.** Resolves the runtime value for a GraphQL field.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TSource</td>
<td></td>
<td></td>
<td>Source object type passed to resolvers.</td>
</tr>
<tr>
<td>TContext</td>
<td></td>
<td></td>
<td>Context object type passed to resolvers.</td>
</tr>
<tr>
<td>TArgs</td>
<td></td>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>Argument object type passed to resolvers.</td>
</tr>
<tr>
<td>TResult</td>
<td></td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Result value type.</td>
</tr>
</tbody>
</table>
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLFieldResolver"], "\u003c\n ", ["type", "TSource"], ",\n ", ["type", "TContext"], ",\n ", ["type", "TArgs"], " = ", ["keyword", "any"], ",\n ", ["type", "TResult"], " = ", ["keyword", "unknown"], ",\n\u003e = (\n ", ["parameter", "source"], ": ", ["type", "TSource"], ",\n ", ["parameter", "args"], ": ", ["type", "TArgs"], ",\n ", ["parameter", "context"], ": ", ["type", "TContext"], ",\n ", ["parameter", "info"], ": ", ["link", "GraphQLResolveInfo", "/api-v17/type#graphqlresolveinfo"], ",\n) =\u003e ", ["type", "TResult"], ";"]} />
<hr className="api-item-divider" />
#### GraphQLResolveInfoHelpers
**Interface.** Utilities available from resolver info for tracking asynchronous work.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>promiseAll</td>
<td><ApiType parts={["(\n ", ["parameter", "values"], ": ", ["keyword", "readonly"], " (\n \u007c ", ["type", "T"], "\n \u007c ", ["type", "PromiseLike"], "\u003c", ["type", "T"], "\u003e\n )[],\n) =\u003e ", ["type", "Promise"], "\u003c", ["type", "T"], "[]\u003e"]} /></td>
<td>Promise.all wrapper that allows rejected branches to be tracked<br />
as execution async work.<br />
Intended use: return or await this promise from resolver work.<br />
Un-awaited async side effects are an anti-pattern:<br />
const { promiseAll } = info.getAsyncHelpers();<br />
promiseAll([someAsyncWork(), someOtherAsyncWork()]).catch(() => undefined);<br />
In that anti-pattern, tracking starts only after rejection (on a<br />
later microtask), so this work is not guaranteed to delay<br />
<code>{"hooks.asyncWorkFinished"}</code>.<br />
Use <code>{"track(...)"}</code> for un-awaited async side effects:<br />
const { track } = info.getAsyncHelpers();<br />
track([<br />
someAsyncWork().catch(() => undefined),<br />
someOtherAsyncWork().catch(() => undefined)<br />
]);</td>
</tr>
<tr>
<td>track</td>
<td><ApiType parts={["(", ["parameter", "maybePromises"], ": ", ["keyword", "readonly"], " ", ["keyword", "unknown"], "[]) =\u003e ", ["keyword", "void"]]} /></td>
<td>Tracks asynchronous work that should delay execution completion hooks.</td>
</tr>
</tbody>
</table>
<hr className="api-item-divider" />
#### GraphQLResolveInfo
**Interface.** Information about the currently executing GraphQL field.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>fieldName</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The field name referenced by this schema coordinate.</td>
</tr>
<tr>
<td>fieldNodes</td>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "FieldNode", "/api-v17/language#fieldnode"], "[]"]} /></td>
<td>AST field nodes that contributed to the current field execution.</td>
</tr>
<tr>
<td>returnType</td>
<td><ApiType parts={[["link", "GraphQLOutputType", "/api-v17/type#graphqloutputtype"]]} /></td>
<td>GraphQL output type declared for the current field.</td>
</tr>
<tr>
<td>parentType</td>
<td><ApiType parts={[["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"]]} /></td>
<td>Object type that owns the current field.</td>
</tr>
<tr>
<td>path</td>
<td><ApiType parts={[["link", "Path", "/api-v17/type#responsepath"]]} /></td>
<td>Response path where this error occurred during execution.</td>
</tr>
<tr>
<td>schema</td>
<td><ApiType parts={[["link", "GraphQLSchema", "/api-v17/type#graphqlschema"]]} /></td>
<td>The schema used for validation or execution.</td>
</tr>
<tr>
<td>fragments</td>
<td><ApiType parts={[["type", "ObjMap"], "\u003c", ["link", "FragmentDefinitionNode", "/api-v17/language#fragmentdefinitionnode"], "\u003e"]} /></td>
<td>Fragment definitions in the operation document keyed by fragment name.</td>
</tr>
<tr>
<td>rootValue</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Initial root value passed to the operation.</td>
</tr>
<tr>
<td>operation</td>
<td><ApiType parts={[["link", "OperationDefinitionNode", "/api-v17/language#operationdefinitionnode"]]} /></td>
<td>The operation selected for execution.</td>
</tr>
<tr>
<td>variableValues</td>
<td><ApiType parts={[["link", "VariableValues", "/api-v17/execution#variablevalues"]]} /></td>
<td>Coerced variable values and source metadata for this operation. Resolver<br />
code that needs runtime variable values should read <code>{"variableValues.coerced"}</code>.</td>
</tr>
<tr>
<td>getAbortSignal</td>
<td><ApiType parts={["() =\u003e ", ["keyword", "any"]]} /></td>
<td>Returns the AbortSignal supplied for this execution, if any.</td>
</tr>
<tr>
<td>getAsyncHelpers</td>
<td><ApiType parts={["() =\u003e ", ["link", "GraphQLResolveInfoHelpers", "/api-v17/type#graphqlresolveinfohelpers"]]} /></td>
<td>Returns helper functions for tracking asynchronous resolver work.</td>
</tr>
</tbody>
</table>
<hr className="api-item-divider" />
#### GraphQLFieldExtensions
**Interface.** Custom extensions
**Remarks:** Use a unique identifier name for your extension, for example the name of
your library or project. Do not use a shortened identifier as this increases
the risk of conflicts. We recommend you add at most one extension field,
an object which can contain all the values you need.
We've provided these template arguments because this is an open type and
you may find them useful.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>_TSource</td>
<td></td>
<td></td>
<td>Reserved source type parameter for extension typing.</td>
</tr>
<tr>
<td>_TContext</td>
<td></td>
<td></td>
<td>Reserved context type parameter for extension typing.</td>
</tr>
<tr>
<td>_TArgs</td>
<td></td>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>Reserved argument type parameter for extension typing.</td>
</tr>
</tbody>
</table>
<hr className="api-item-divider" />
#### GraphQLFieldConfig
**Interface.** Configuration used to define a GraphQL field.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TSource</td>
<td></td>
<td></td>
<td>Source object type passed to resolvers.</td>
</tr>
<tr>
<td>TContext</td>
<td></td>
<td></td>
<td>Context object type passed to resolvers.</td>
</tr>
<tr>
<td>TArgs</td>
<td></td>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>Argument object type passed to resolvers.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>description?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>type</td>
<td><ApiType parts={[["link", "GraphQLOutputType", "/api-v17/type#graphqloutputtype"]]} /></td>
<td>The GraphQL type reference or runtime type for this element.</td>
</tr>
<tr>
<td>args?</td>
<td><ApiType parts={[["link", "GraphQLFieldConfigArgumentMap", "/api-v17/type#graphqlfieldconfigargumentmap"]]} /></td>
<td>Arguments accepted by this field or directive.</td>
</tr>
<tr>
<td>resolve?</td>
<td><ApiType parts={[["link", "GraphQLFieldResolver", "/api-v17/type#graphqlfieldresolver"], "\u003c\n ", ["type", "TSource"], ",\n ", ["type", "TContext"], ",\n ", ["type", "TArgs"], "\n\u003e"]} /></td>
<td>Resolver function used to produce this field value.</td>
</tr>
<tr>
<td>subscribe?</td>
<td><ApiType parts={[["link", "GraphQLFieldResolver", "/api-v17/type#graphqlfieldresolver"], "\u003c\n ", ["type", "TSource"], ",\n ", ["type", "TContext"], ",\n ", ["type", "TArgs"], "\n\u003e"]} /></td>
<td>Resolver function used to create a subscription event stream for this field.</td>
</tr>
<tr>
<td>deprecationReason?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Reason this element is deprecated, if one was provided.</td>
</tr>
<tr>
<td>extensions?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c\n ", ["type", "Readonly"], "\u003c\n ", ["link", "GraphQLFieldExtensions", "/api-v17/type#graphqlfieldextensions"], "\u003c\n ", ["type", "TSource"], ",\n ", ["type", "TContext"], ",\n ", ["type", "TArgs"], "\n \u003e\n \u003e\n\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "FieldDefinitionNode", "/api-v17/language#fielddefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
</tbody>
</table>
<hr className="api-item-divider" />
#### GraphQLFieldConfigArgumentMap
**Type alias.** A map of argument names to argument configuration objects.
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLFieldConfigArgumentMap"], " = ", ["type", "ObjMap"], "\u003c", ["link", "GraphQLArgumentConfig", "/api-v17/type#graphqlargumentconfig"], "\u003e;"]} />
<hr className="api-item-divider" />
#### GraphQLArgumentExtensions
**Interface.** Custom extensions
**Remarks:** Use a unique identifier name for your extension, for example the name of
your library or project. Do not use a shortened identifier as this increases
the risk of conflicts. We recommend you add at most one extension field,
an object which can contain all the values you need.
<hr className="api-item-divider" />
#### GraphQLArgumentConfig
**Interface.** Configuration used to define a GraphQL argument.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>description?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>type</td>
<td><ApiType parts={[["link", "GraphQLInputType", "/api-v17/type#graphqlinputtype"]]} /></td>
<td>The GraphQL type reference or runtime type for this element.</td>
</tr>
<tr>
<td>defaultValue?</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Deprecated legacy default value for this argument. Use <code>{"default"}</code> instead.</td>
</tr>
<tr>
<td>default?</td>
<td><ApiType parts={[["link", "GraphQLDefaultInput", "/api-v17/type#graphqldefaultinput"]]} /></td>
<td>Default value represented as either a runtime value or a GraphQL literal.</td>
</tr>
<tr>
<td>deprecationReason?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Reason this element is deprecated, if one was provided.</td>
</tr>
<tr>
<td>extensions?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["type", "Readonly"], "\u003c", ["link", "GraphQLArgumentExtensions", "/api-v17/type#graphqlargumentextensions"], "\u003e\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "InputValueDefinitionNode", "/api-v17/language#inputvaluedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
</tbody>
</table>
<hr className="api-item-divider" />
#### GraphQLFieldConfigMap
**Type alias.** A map of field names to field configuration objects.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TSource</td>
<td></td>
<td></td>
<td>Source object type passed to resolvers.</td>
</tr>
<tr>
<td>TContext</td>
<td></td>
<td></td>
<td>Context object type passed to resolvers.</td>
</tr>
</tbody>
</table>
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLFieldConfigMap"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e =\n ", ["type", "ObjMap"], "\u003c\n ", ["link", "GraphQLFieldConfig", "/api-v17/type#graphqlfieldconfig"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e\n \u003e;"]} />
<hr className="api-item-divider" />
#### GraphQLField
**Interface.** A resolved GraphQL field definition.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TSource</td>
<td></td>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>Source object type passed to resolvers.</td>
</tr>
<tr>
<td>TContext</td>
<td></td>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>Context object type passed to resolvers.</td>
</tr>
<tr>
<td>TArgs</td>
<td></td>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>Argument object type passed to resolvers.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>parentType</td>
<td><ApiType parts={["\u007c ", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e\n\u007c ", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e\n\u007c ", ["keyword", "undefined"]]} /></td>
<td>Object or interface type that owns this field, if known.</td>
</tr>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>type</td>
<td><ApiType parts={[["link", "GraphQLOutputType", "/api-v17/type#graphqloutputtype"]]} /></td>
<td>The GraphQL type reference or runtime type for this element.</td>
</tr>
<tr>
<td>args</td>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "GraphQLArgument", "/api-v17/type#graphqlargument"], "[]"]} /></td>
<td>Arguments accepted by this field or directive.</td>
</tr>
<tr>
<td>resolve?</td>
<td><ApiType parts={[["link", "GraphQLFieldResolver", "/api-v17/type#graphqlfieldresolver"], "\u003c\n ", ["type", "TSource"], ",\n ", ["type", "TContext"], ",\n ", ["type", "TArgs"], "\n\u003e"]} /></td>
<td>Resolver function used to produce this field value.</td>
</tr>
<tr>
<td>subscribe?</td>
<td><ApiType parts={[["link", "GraphQLFieldResolver", "/api-v17/type#graphqlfieldresolver"], "\u003c\n ", ["type", "TSource"], ",\n ", ["type", "TContext"], ",\n ", ["type", "TArgs"], "\n\u003e"]} /></td>
<td>Resolver function used to create a subscription event stream for this field.</td>
</tr>
<tr>
<td>deprecationReason</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Reason this element is deprecated, if one was provided.</td>
</tr>
<tr>
<td>extensions</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c\n ", ["link", "GraphQLFieldExtensions", "/api-v17/type#graphqlfieldextensions"], "\u003c\n ", ["type", "TSource"], ",\n ", ["type", "TContext"], ",\n ", ["type", "TArgs"], "\n \u003e\n\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "FieldDefinitionNode", "/api-v17/language#fielddefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### toConfig()
Returns a normalized configuration object for this field.
**Signature:**
<ApiSignature parts={[["name", "toConfig"], "(): ", ["type", "GraphQLFieldNormalizedConfig"], "\u003c\n ", ["type", "TSource"], ",\n ", ["type", "TContext"], ",\n ", ["type", "TArgs"], "\n\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "GraphQLFieldNormalizedConfig"], "\u003c\n ", ["type", "TSource"], ",\n ", ["type", "TContext"], ",\n ", ["type", "TArgs"], "\n\u003e"]} /></td>
<td>A configuration object that can be used to recreate this field.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLField, GraphQLObjectType, GraphQLString } from 'graphql/type';
const Query = new GraphQLObjectType({ name: 'Query', fields: {} });
const field = new GraphQLField(Query, 'greeting', {
type: GraphQLString,
extensions: { cacheSeconds: 60 },
});
field.toConfig().type; // => GraphQLString
field.toConfig().extensions; // => { cacheSeconds: 60 }
```
<hr className="api-subsection-divider" />
##### toString()
Returns this field as a schema coordinate string.
**Signature:**
<ApiSignature parts={[["name", "toString"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The field coordinate.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLField, GraphQLObjectType, GraphQLString } from 'graphql/type';
const Query = new GraphQLObjectType({ name: 'Query', fields: {} });
const field = new GraphQLField(Query, 'greeting', { type: GraphQLString });
field.toString(); // => 'Query.greeting'
```
<hr className="api-subsection-divider" />
##### toJSON()
Returns the JSON representation used when this object is serialized.
**Signature:**
<ApiSignature parts={[["name", "toJSON"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The field coordinate.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLField, GraphQLObjectType, GraphQLString } from 'graphql/type';
const Query = new GraphQLObjectType({ name: 'Query', fields: {} });
const field = new GraphQLField(Query, 'greeting', { type: GraphQLString });
JSON.stringify(field); // => '"Query.greeting"'
```
<hr className="api-item-divider" />
#### GraphQLArgument
**Interface.** A resolved GraphQL argument definition.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>parent</td>
<td><ApiType parts={[["link", "GraphQLDirective", "/api-v17/type#graphqldirective"], " \u007c ", ["link", "GraphQLField", "/api-v17/type#graphqlfield"]]} /></td>
<td>Field or directive that owns this argument.</td>
</tr>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>type</td>
<td><ApiType parts={[["link", "GraphQLInputType", "/api-v17/type#graphqlinputtype"]]} /></td>
<td>The GraphQL type reference or runtime type for this element.</td>
</tr>
<tr>
<td>defaultValue</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Deprecated legacy default value used when no explicit value is supplied.<br />
Use <code>{"default"}</code> instead.</td>
</tr>
<tr>
<td>default</td>
<td><ApiType parts={[["link", "GraphQLDefaultInput", "/api-v17/type#graphqldefaultinput"], " \u007c ", ["keyword", "undefined"]]} /></td>
<td>Default value represented as either a runtime value or a GraphQL literal.</td>
</tr>
<tr>
<td>deprecationReason</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Reason this element is deprecated, if one was provided.</td>
</tr>
<tr>
<td>extensions</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c", ["link", "GraphQLArgumentExtensions", "/api-v17/type#graphqlargumentextensions"], "\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "InputValueDefinitionNode", "/api-v17/language#inputvaluedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### toConfig()
Returns a normalized configuration object for this argument.
**Signature:**
<ApiSignature parts={[["name", "toConfig"], "(): ", ["type", "GraphQLArgumentNormalizedConfig"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "GraphQLArgumentNormalizedConfig"]]} /></td>
<td>A configuration object that can be used to recreate this argument.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import {
GraphQLArgument,
GraphQLField,
GraphQLObjectType,
GraphQLString,
} from 'graphql/type';
const Query = new GraphQLObjectType({ name: 'Query', fields: {} });
const field = new GraphQLField(Query, 'greeting', { type: GraphQLString });
const arg = new GraphQLArgument(field, 'name', {
type: GraphQLString,
default: { value: 'world' },
});
arg.toConfig().default.value; // => 'world'
```
<hr className="api-subsection-divider" />
##### toString()
Returns this argument as a schema coordinate string.
**Signature:**
<ApiSignature parts={[["name", "toString"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The argument coordinate.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import {
GraphQLArgument,
GraphQLField,
GraphQLObjectType,
GraphQLString,
} from 'graphql/type';
const Query = new GraphQLObjectType({ name: 'Query', fields: {} });
const field = new GraphQLField(Query, 'greeting', { type: GraphQLString });
const arg = new GraphQLArgument(field, 'name', { type: GraphQLString });
arg.toString(); // => 'Query.greeting(name:)'
```
<hr className="api-subsection-divider" />
##### toJSON()
Returns the JSON representation used when this object is serialized.
**Signature:**
<ApiSignature parts={[["name", "toJSON"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The argument coordinate.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import {
GraphQLArgument,
GraphQLField,
GraphQLObjectType,
GraphQLString,
} from 'graphql/type';
const Query = new GraphQLObjectType({ name: 'Query', fields: {} });
const field = new GraphQLField(Query, 'greeting', { type: GraphQLString });
const arg = new GraphQLArgument(field, 'name', { type: GraphQLString });
JSON.stringify(arg); // => '"Query.greeting(name:)"'
```
<hr className="api-item-divider" />
#### GraphQLFieldMap
**Type alias.** A map of field names to resolved field definitions.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TSource</td>
<td></td>
<td></td>
<td>Source object type passed to resolvers.</td>
</tr>
<tr>
<td>TContext</td>
<td></td>
<td></td>
<td>Context object type passed to resolvers.</td>
</tr>
</tbody>
</table>
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLFieldMap"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e =\n ", ["type", "ObjMap"], "\u003c\n ", ["link", "GraphQLField", "/api-v17/type#graphqlfield"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e\n \u003e;"]} />
<hr className="api-item-divider" />
#### GraphQLDefaultInput
**Type alias.** Default input represented as either a runtime value or a GraphQL literal.
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLDefaultInput"], " =\n \u007c \u007b ", ["property", "value"], ": ", ["keyword", "unknown"], "; ", ["property", "literal"], "?: ", ["keyword", "never"], " \u007d\n \u007c \u007b ", ["property", "literal"], ": ", ["link", "ConstValueNode", "/api-v17/language#constvaluenode"], "; ", ["property", "value"], "?: ", ["keyword", "never"], " \u007d;"]} />
<hr className="api-item-divider" />
#### GraphQLInterfaceTypeExtensions
**Interface.** Custom extensions
**Remarks:** Use a unique identifier name for your extension, for example the name of
your library or project. Do not use a shortened identifier as this increases
the risk of conflicts. We recommend you add at most one extension field,
an object which can contain all the values you need.
<hr className="api-item-divider" />
#### GraphQLInterfaceTypeConfig
**Interface.** Configuration used to construct a GraphQLInterfaceType.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TSource</td>
<td></td>
<td></td>
<td>Source object type passed to resolvers.</td>
</tr>
<tr>
<td>TContext</td>
<td></td>
<td></td>
<td>Context object type passed to resolvers.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>interfaces?</td>
<td><ApiType parts={[["link", "ThunkReadonlyArray", "/api-v17/type#thunkreadonlyarray"], "\u003c", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"], "\u003e"]} /></td>
<td>Interfaces implemented by this object or interface type.</td>
</tr>
<tr>
<td>fields</td>
<td><ApiType parts={[["link", "ThunkObjMap", "/api-v17/type#thunkobjmap"], "\u003c\n ", ["link", "GraphQLFieldConfig", "/api-v17/type#graphqlfieldconfig"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e\n\u003e"]} /></td>
<td>Fields declared by this object, interface, input object, or literal.</td>
</tr>
<tr>
<td>resolveType?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c\n ", ["link", "GraphQLTypeResolver", "/api-v17/type#graphqltyperesolver"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e\n\u003e"]} /></td>
<td>Optionally provide a custom type resolver function. If one is not provided,<br />
the default implementation will call <code>{"isTypeOf"}</code> on each implementing<br />
Object type.</td>
</tr>
<tr>
<td>extensions?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["type", "Readonly"], "\u003c", ["link", "GraphQLInterfaceTypeExtensions", "/api-v17/type#graphqlinterfacetypeextensions"], "\u003e\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "InterfaceTypeDefinitionNode", "/api-v17/language#interfacetypedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
<tr>
<td>extensionASTNodes?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "readonly"], " ", ["link", "InterfaceTypeExtensionNode", "/api-v17/language#interfacetypeextensionnode"], "[]\u003e"]} /></td>
<td>AST extension nodes applied to this schema element.</td>
</tr>
</tbody>
</table>
<hr className="api-item-divider" />
#### GraphQLUnionTypeExtensions
**Interface.** Custom extensions
**Remarks:** Use a unique identifier name for your extension, for example the name of
your library or project. Do not use a shortened identifier as this increases
the risk of conflicts. We recommend you add at most one extension field,
an object which can contain all the values you need.
<hr className="api-item-divider" />
#### GraphQLUnionTypeConfig
**Interface.** Configuration used to construct a GraphQLUnionType.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type Parameters</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Constraint</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>TSource</td>
<td></td>
<td></td>
<td>Source object type passed to resolvers.</td>
</tr>
<tr>
<td>TContext</td>
<td></td>
<td></td>
<td>Context object type passed to resolvers.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>types</td>
<td><ApiType parts={[["link", "ThunkReadonlyArray", "/api-v17/type#thunkreadonlyarray"], "\u003c", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "\u003e"]} /></td>
<td>Object types that belong to this union type.</td>
</tr>
<tr>
<td>resolveType?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c\n ", ["link", "GraphQLTypeResolver", "/api-v17/type#graphqltyperesolver"], "\u003c", ["type", "TSource"], ", ", ["type", "TContext"], "\u003e\n\u003e"]} /></td>
<td>Optionally provide a custom type resolver function. If one is not provided,<br />
the default implementation will call <code>{"isTypeOf"}</code> on each implementing<br />
Object type.</td>
</tr>
<tr>
<td>extensions?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["type", "Readonly"], "\u003c", ["link", "GraphQLUnionTypeExtensions", "/api-v17/type#graphqluniontypeextensions"], "\u003e\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "UnionTypeDefinitionNode", "/api-v17/language#uniontypedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
<tr>
<td>extensionASTNodes?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "readonly"], " ", ["link", "UnionTypeExtensionNode", "/api-v17/language#uniontypeextensionnode"], "[]\u003e"]} /></td>
<td>AST extension nodes applied to this schema element.</td>
</tr>
</tbody>
</table>
<hr className="api-item-divider" />
#### GraphQLEnumTypeExtensions
**Interface.** Custom extensions
**Remarks:** Use a unique identifier name for your extension, for example the name of
your library or project. Do not use a shortened identifier as this increases
the risk of conflicts. We recommend you add at most one extension field,
an object which can contain all the values you need.
<hr className="api-item-divider" />
#### GraphQLEnumTypeConfig
**Interface.** Configuration used to construct a GraphQLEnumType.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>values</td>
<td><ApiType parts={[["link", "ThunkObjMap", "/api-v17/type#thunkobjmap"], "\u003c", ["link", "GraphQLEnumValueConfig", "/api-v17/type#graphqlenumvalueconfig"], "\u003e"]} /></td>
<td>Values contained in this enum, list, or input-object definition.</td>
</tr>
<tr>
<td>extensions?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["type", "Readonly"], "\u003c", ["link", "GraphQLEnumTypeExtensions", "/api-v17/type#graphqlenumtypeextensions"], "\u003e\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "EnumTypeDefinitionNode", "/api-v17/language#enumtypedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
<tr>
<td>extensionASTNodes?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "readonly"], " ", ["link", "EnumTypeExtensionNode", "/api-v17/language#enumtypeextensionnode"], "[]\u003e"]} /></td>
<td>AST extension nodes applied to this schema element.</td>
</tr>
</tbody>
</table>
<hr className="api-item-divider" />
#### GraphQLEnumValueConfigMap
**Type alias.** A map of enum value names to enum value configuration objects.
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLEnumValueConfigMap"], " = ", ["type", "ObjMap"], "\u003c", ["link", "GraphQLEnumValueConfig", "/api-v17/type#graphqlenumvalueconfig"], "\u003e;"]} />
<hr className="api-item-divider" />
#### GraphQLEnumValueExtensions
**Interface.** Custom extensions
**Remarks:** Use a unique identifier name for your extension, for example the name of
your library or project. Do not use a shortened identifier as this increases
the risk of conflicts. We recommend you add at most one extension field,
an object which can contain all the values you need.
<hr className="api-item-divider" />
#### GraphQLEnumValueConfig
**Interface.** Configuration used to define a GraphQL enum value.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>description?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>value?</td>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>Parsed value represented by this node.</td>
</tr>
<tr>
<td>deprecationReason?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Reason this element is deprecated, if one was provided.</td>
</tr>
<tr>
<td>extensions?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["type", "Readonly"], "\u003c", ["link", "GraphQLEnumValueExtensions", "/api-v17/type#graphqlenumvalueextensions"], "\u003e\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "EnumValueDefinitionNode", "/api-v17/language#enumvaluedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
</tbody>
</table>
<hr className="api-item-divider" />
#### GraphQLEnumValue
**Interface.** A resolved GraphQL enum value definition.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>parentEnum</td>
<td><ApiType parts={[["link", "GraphQLEnumType", "/api-v17/type#graphqlenumtype"]]} /></td>
<td>Enum type that owns this enum value.</td>
</tr>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>value</td>
<td><ApiType parts={[["keyword", "any"]]} /></td>
<td>Parsed value represented by this node.</td>
</tr>
<tr>
<td>deprecationReason</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Reason this element is deprecated, if one was provided.</td>
</tr>
<tr>
<td>extensions</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c", ["link", "GraphQLEnumValueExtensions", "/api-v17/type#graphqlenumvalueextensions"], "\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "EnumValueDefinitionNode", "/api-v17/language#enumvaluedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### toConfig()
Returns a normalized configuration object for this enum value.
**Signature:**
<ApiSignature parts={[["name", "toConfig"], "(): ", ["type", "GraphQLEnumValueNormalizedConfig"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "GraphQLEnumValueNormalizedConfig"]]} /></td>
<td>A configuration object that can be used to recreate this enum value.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLEnumType, GraphQLEnumValue } from 'graphql/type';
const Episode = new GraphQLEnumType({
name: 'Episode',
values: { NEW_HOPE: { value: 4 } },
});
const enumValue = new GraphQLEnumValue(Episode, 'EMPIRE', {
value: 5,
extensions: { trilogy: 'original' },
});
enumValue.toConfig(); // => { description: undefined, value: 5, deprecationReason: undefined, extensions: { trilogy: 'original' }, astNode: undefined }
```
<hr className="api-subsection-divider" />
##### toString()
Returns this enum value as a schema coordinate string.
**Signature:**
<ApiSignature parts={[["name", "toString"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>Enum value coordinate.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLEnumType, GraphQLEnumValue } from 'graphql/type';
const Episode = new GraphQLEnumType({
name: 'Episode',
values: { NEW_HOPE: { value: 4 } },
});
const enumValue = new GraphQLEnumValue(Episode, 'EMPIRE', { value: 5 });
enumValue.toString(); // => 'Episode.EMPIRE'
```
<hr className="api-subsection-divider" />
##### toJSON()
Returns the JSON representation used when this object is serialized.
**Signature:**
<ApiSignature parts={[["name", "toJSON"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>Enum value coordinate.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLEnumType, GraphQLEnumValue } from 'graphql/type';
const Episode = new GraphQLEnumType({
name: 'Episode',
values: { NEW_HOPE: { value: 4 } },
});
const enumValue = new GraphQLEnumValue(Episode, 'EMPIRE', { value: 5 });
JSON.stringify(enumValue); // => '"Episode.EMPIRE"'
```
<hr className="api-item-divider" />
#### GraphQLInputObjectTypeExtensions
**Interface.** Custom extensions
**Remarks:** Use a unique identifier name for your extension, for example the name of
your library or project. Do not use a shortened identifier as this increases
the risk of conflicts. We recommend you add at most one extension field,
an object which can contain all the values you need.
<hr className="api-item-divider" />
#### GraphQLInputObjectTypeConfig
**Interface.** Configuration used to construct a GraphQLInputObjectType.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>fields</td>
<td><ApiType parts={[["link", "ThunkObjMap", "/api-v17/type#thunkobjmap"], "\u003c", ["link", "GraphQLInputFieldConfig", "/api-v17/type#graphqlinputfieldconfig"], "\u003e"]} /></td>
<td>Fields declared by this object, interface, input object, or literal.</td>
</tr>
<tr>
<td>extensions?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["type", "Readonly"], "\u003c", ["link", "GraphQLInputObjectTypeExtensions", "/api-v17/type#graphqlinputobjecttypeextensions"], "\u003e\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "InputObjectTypeDefinitionNode", "/api-v17/language#inputobjecttypedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
<tr>
<td>extensionASTNodes?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "readonly"], " ", ["link", "InputObjectTypeExtensionNode", "/api-v17/language#inputobjecttypeextensionnode"], "[]\u003e"]} /></td>
<td>AST extension nodes applied to this schema element.</td>
</tr>
<tr>
<td>isOneOf?</td>
<td><ApiType parts={[["keyword", "boolean"]]} /></td>
<td>Whether this input object uses the experimental OneOf input object semantics.</td>
</tr>
</tbody>
</table>
<hr className="api-item-divider" />
#### GraphQLInputFieldExtensions
**Interface.** Custom extensions
**Remarks:** Use a unique identifier name for your extension, for example the name of
your library or project. Do not use a shortened identifier as this increases
the risk of conflicts. We recommend you add at most one extension field,
an object which can contain all the values you need.
<hr className="api-item-divider" />
#### GraphQLInputFieldConfig
**Interface.** Configuration used to define a GraphQL input field.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>description?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>type</td>
<td><ApiType parts={[["link", "GraphQLInputType", "/api-v17/type#graphqlinputtype"]]} /></td>
<td>The GraphQL type reference or runtime type for this element.</td>
</tr>
<tr>
<td>defaultValue?</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Deprecated legacy default value for this input field. Use <code>{"default"}</code><br />
instead.</td>
</tr>
<tr>
<td>default?</td>
<td><ApiType parts={[["link", "GraphQLDefaultInput", "/api-v17/type#graphqldefaultinput"]]} /></td>
<td>Default value represented as either a runtime value or a GraphQL literal.</td>
</tr>
<tr>
<td>deprecationReason?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Reason this element is deprecated, if one was provided.</td>
</tr>
<tr>
<td>extensions?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["type", "Readonly"], "\u003c", ["link", "GraphQLInputFieldExtensions", "/api-v17/type#graphqlinputfieldextensions"], "\u003e\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "InputValueDefinitionNode", "/api-v17/language#inputvaluedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
</tbody>
</table>
<hr className="api-item-divider" />
#### GraphQLInputFieldConfigMap
**Type alias.** A map of input field names to input field configuration objects.
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLInputFieldConfigMap"], " = ", ["type", "ObjMap"], "\u003c", ["link", "GraphQLInputFieldConfig", "/api-v17/type#graphqlinputfieldconfig"], "\u003e;"]} />
<hr className="api-item-divider" />
#### GraphQLInputField
**Interface.** A resolved GraphQL input field definition.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>parentType</td>
<td><ApiType parts={[["link", "GraphQLInputObjectType", "/api-v17/type#graphqlinputobjecttype"]]} /></td>
<td>Input object type that owns this input field.</td>
</tr>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>type</td>
<td><ApiType parts={[["link", "GraphQLInputType", "/api-v17/type#graphqlinputtype"]]} /></td>
<td>The GraphQL type reference or runtime type for this element.</td>
</tr>
<tr>
<td>defaultValue</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Deprecated legacy default value used when no explicit value is supplied.<br />
Use <code>{"default"}</code> instead.</td>
</tr>
<tr>
<td>default</td>
<td><ApiType parts={[["link", "GraphQLDefaultInput", "/api-v17/type#graphqldefaultinput"], " \u007c ", ["keyword", "undefined"]]} /></td>
<td>Default value represented as either a runtime value or a GraphQL literal.</td>
</tr>
<tr>
<td>deprecationReason</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Reason this element is deprecated, if one was provided.</td>
</tr>
<tr>
<td>extensions</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c", ["link", "GraphQLInputFieldExtensions", "/api-v17/type#graphqlinputfieldextensions"], "\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "InputValueDefinitionNode", "/api-v17/language#inputvaluedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### toConfig()
Returns a normalized configuration object for this input field.
**Signature:**
<ApiSignature parts={[["name", "toConfig"], "(): ", ["type", "GraphQLInputFieldNormalizedConfig"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "GraphQLInputFieldNormalizedConfig"]]} /></td>
<td>A configuration object that can be used to recreate this input field.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLInputField, GraphQLInputObjectType, GraphQLString } from 'graphql/type';
const ReviewInput = new GraphQLInputObjectType({
name: 'ReviewInput',
fields: {},
});
const field = new GraphQLInputField(ReviewInput, 'commentary', {
type: GraphQLString,
extensions: { form: 'review' },
});
field.toConfig().extensions; // => { form: 'review' }
```
<hr className="api-subsection-divider" />
##### toString()
Returns this input field as a schema coordinate string.
**Signature:**
<ApiSignature parts={[["name", "toString"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The input field coordinate.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLInputField, GraphQLInputObjectType, GraphQLString } from 'graphql/type';
const ReviewInput = new GraphQLInputObjectType({
name: 'ReviewInput',
fields: {},
});
const field = new GraphQLInputField(ReviewInput, 'commentary', {
type: GraphQLString,
});
field.toString(); // => 'ReviewInput.commentary'
```
<hr className="api-subsection-divider" />
##### toJSON()
Returns the JSON representation used when this object is serialized.
**Signature:**
<ApiSignature parts={[["name", "toJSON"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The input field coordinate.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLInputField, GraphQLInputObjectType, GraphQLString } from 'graphql/type';
const ReviewInput = new GraphQLInputObjectType({
name: 'ReviewInput',
fields: {},
});
const field = new GraphQLInputField(ReviewInput, 'commentary', {
type: GraphQLString,
});
JSON.stringify(field); // => '"ReviewInput.commentary"'
```
<hr className="api-item-divider" />
#### GraphQLInputFieldMap
**Type alias.** A map of input field names to resolved input field definitions.
<ApiSignature parts={[["keyword", "type"], " ", ["name", "GraphQLInputFieldMap"], " = ", ["type", "ObjMap"], "\u003c", ["link", "GraphQLInputField", "/api-v17/type#graphqlinputfield"], "\u003e;"]} />
## Category: Directives
<div className="api-category-toc">
<p>
<strong>Classes:</strong><br />
<a href="/api-v17/type#graphqldirective">GraphQLDirective</a>
</p>
<p>
<strong>Functions:</strong><br />
<a href="/api-v17/type#isdirective">isDirective()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertdirective">assertDirective()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#isspecifieddirective">isSpecifiedDirective()</a>
</p>
<p>
<strong>Constants:</strong><br />
<a href="/api-v17/type#graphqlincludedirective">GraphQLIncludeDirective</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlskipdirective">GraphQLSkipDirective</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqldeferdirective">GraphQLDeferDirective</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlstreamdirective">GraphQLStreamDirective</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#default_deprecation_reason">DEFAULT_DEPRECATION_REASON</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqldeprecateddirective">GraphQLDeprecatedDirective</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlspecifiedbydirective">GraphQLSpecifiedByDirective</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqloneofdirective">GraphQLOneOfDirective</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#specifieddirectives">specifiedDirectives</a>
</p>
<p>
<strong>Types:</strong><br />
<a href="/api-v17/type#graphqldirectiveextensions">GraphQLDirectiveExtensions</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqldirectiveconfig">GraphQLDirectiveConfig</a>
</p>
</div>
### Classes
#### GraphQLDirective
Directives are used by the GraphQL runtime as a way of modifying execution
behavior. Type system creators will usually not create these directly.
<hr className="api-subsection-divider" />
##### Constructor
Creates a GraphQLDirective instance.
**Signature:**
<ApiSignature parts={[["keyword", "new"], " ", ["name", "GraphQLDirective"], "(", ["parameter", "config"], ": ", ["type", "Readonly"], "\u003c", ["link", "GraphQLDirectiveConfig", "/api-v17/type#graphqldirectiveconfig"], "\u003e);"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>config</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c", ["link", "GraphQLDirectiveConfig", "/api-v17/type#graphqldirectiveconfig"], "\u003e"]} /></td>
<td>Configuration describing this object.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### Members
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>locations</td>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "DirectiveLocation", "/api-v17/language#directivelocation"], "[]"]} /></td>
<td>Locations where this directive may be applied.</td>
</tr>
<tr>
<td>args</td>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "GraphQLArgument", "/api-v17/type#graphqlargument"], "[]"]} /></td>
<td>Arguments accepted by this field or directive.</td>
</tr>
<tr>
<td>isRepeatable</td>
<td><ApiType parts={[["keyword", "boolean"]]} /></td>
<td>Whether this directive may appear more than once at the same location.</td>
</tr>
<tr>
<td>deprecationReason</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Reason this element is deprecated, if one was provided.</td>
</tr>
<tr>
<td>extensions</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c", ["link", "GraphQLDirectiveExtensions", "/api-v17/type#graphqldirectiveextensions"], "\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "DirectiveDefinitionNode", "/api-v17/language#directivedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
<tr>
<td>extensionASTNodes</td>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "DirectiveExtensionNode", "/api-v17/language#directiveextensionnode"], "[]"]} /></td>
<td>AST extension nodes applied to this schema element.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### toConfig()
Returns a normalized configuration object for this object.
**Signature:**
<ApiSignature parts={[["name", "toConfig"], "(): ", ["type", "GraphQLDirectiveNormalizedConfig"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "GraphQLDirectiveNormalizedConfig"]]} /></td>
<td>A configuration object that can be used to recreate this object.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { DirectiveLocation } from 'graphql/language';
import { GraphQLDirective, GraphQLString } from 'graphql/type';
const tag = new GraphQLDirective({
name: 'tag',
locations: [DirectiveLocation.FIELD_DEFINITION],
args: {
name: { type: GraphQLString },
},
});
const config = tag.toConfig();
const tagCopy = new GraphQLDirective(config);
config.args.name.type; // => GraphQLString
tagCopy.args[0].name; // => 'name'
```
<hr className="api-subsection-divider" />
##### toString()
Returns the schema coordinate identifying this directive.
**Signature:**
<ApiSignature parts={[["name", "toString"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The directive schema coordinate.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { DirectiveLocation } from 'graphql/language';
import { GraphQLDirective } from 'graphql/type';
const tag = new GraphQLDirective({
name: 'tag',
locations: [DirectiveLocation.FIELD_DEFINITION],
});
tag.toString(); // => '@tag'
```
<hr className="api-subsection-divider" />
##### toJSON()
Returns the JSON representation used when this object is serialized.
**Signature:**
<ApiSignature parts={[["name", "toJSON"], "(): ", ["keyword", "string"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The JSON-serializable representation.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { DirectiveLocation } from 'graphql/language';
import { GraphQLDirective } from 'graphql/type';
const tag = new GraphQLDirective({
name: 'tag',
locations: [DirectiveLocation.FIELD_DEFINITION],
});
tag.toJSON(); // => '@tag'
JSON.stringify({ directive: tag }); // => '{"directive":"@tag"}'
```
### Functions
#### isDirective()
Test if the given value is a GraphQL directive.
**Signature:**
<ApiSignature parts={[["name", "isDirective"], "(\n ", ["parameter", "directive"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "directive"], " ", ["keyword", "is"], " ", ["link", "GraphQLDirective", "/api-v17/type#graphqldirective"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>directive</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Value to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "directive"], " ", ["keyword", "is"], " ", ["link", "GraphQLDirective", "/api-v17/type#graphqldirective"]]} /></td>
<td>True when the value is a GraphQLDirective.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { DirectiveLocation } from 'graphql/language';
import { GraphQLDirective, GraphQLString, isDirective } from 'graphql/type';
const upper = new GraphQLDirective({
name: 'upper',
locations: [DirectiveLocation.FIELD_DEFINITION],
});
isDirective(upper); // => true
isDirective(GraphQLString); // => false
```
<hr className="api-item-divider" />
#### assertDirective()
Returns the value as a GraphQLDirective, or throws if it is not a directive.
**Signature:**
<ApiSignature parts={[["name", "assertDirective"], "(", ["parameter", "directive"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLDirective", "/api-v17/type#graphqldirective"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>directive</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Value to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLDirective", "/api-v17/type#graphqldirective"]]} /></td>
<td>The value typed as a GraphQLDirective.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { DirectiveLocation } from 'graphql/language';
import { assertDirective, GraphQLDirective, GraphQLString } from 'graphql/type';
const upper = new GraphQLDirective({
name: 'upper',
locations: [DirectiveLocation.FIELD_DEFINITION],
});
assertDirective(upper); // => upper
assertDirective(GraphQLString); // throws an error
```
<hr className="api-item-divider" />
#### isSpecifiedDirective()
Returns true when the directive is one of the directives specified by GraphQL.
**Signature:**
<ApiSignature parts={[["name", "isSpecifiedDirective"], "(", ["parameter", "directive"], ": ", ["link", "GraphQLDirective", "/api-v17/type#graphqldirective"], "): ", ["keyword", "boolean"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>directive</td>
<td><ApiType parts={[["link", "GraphQLDirective", "/api-v17/type#graphqldirective"]]} /></td>
<td>Directive to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "boolean"]]} /></td>
<td>True when the directive is specified by GraphQL.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import {
GraphQLDirective,
GraphQLIncludeDirective,
isSpecifiedDirective,
} from 'graphql/type';
import { DirectiveLocation } from 'graphql/language';
const customDirective = new GraphQLDirective({
name: 'auth',
locations: [DirectiveLocation.FIELD_DEFINITION],
});
isSpecifiedDirective(GraphQLIncludeDirective); // => true
isSpecifiedDirective(customDirective); // => false
```
### Constants
#### GraphQLIncludeDirective
Used to conditionally include fields or fragments.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLDirective", "/api-v17/type#graphqldirective"]]} />
<hr className="api-item-divider" />
#### GraphQLSkipDirective
Used to conditionally skip (exclude) fields or fragments.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLDirective", "/api-v17/type#graphqldirective"]]} />
<hr className="api-item-divider" />
#### GraphQLDeferDirective
Experimental directive used to conditionally defer fragments.
This directive is exported for schemas that explicitly opt in to incremental
delivery. It is not included in [`specifiedDirectives`](/api-v17/type#specifieddirectives).
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLDirective", "/api-v17/type#graphqldirective"]]} />
<hr className="api-item-divider" />
#### GraphQLStreamDirective
Experimental directive used to conditionally stream list fields.
This directive is exported for schemas that explicitly opt in to incremental
delivery. It is not included in [`specifiedDirectives`](/api-v17/type#specifieddirectives).
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLDirective", "/api-v17/type#graphqldirective"]]} />
<hr className="api-item-divider" />
#### DEFAULT_DEPRECATION_REASON
Constant string used for default reason for a deprecation.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["literal", "'No longer supported'"]]} />
<hr className="api-item-divider" />
#### GraphQLDeprecatedDirective
Used to declare element of a GraphQL schema as deprecated.
The `reason` argument is non-null and defaults to
[`DEFAULT_DEPRECATION_REASON`](/api-v17/type#default_deprecation_reason).
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLDirective", "/api-v17/type#graphqldirective"]]} />
<hr className="api-item-divider" />
#### GraphQLSpecifiedByDirective
Used to provide a URL for specifying the behavior of custom scalar definitions.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLDirective", "/api-v17/type#graphqldirective"]]} />
<hr className="api-item-divider" />
#### GraphQLOneOfDirective
Used to indicate an Input Object is a OneOf Input Object.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLDirective", "/api-v17/type#graphqldirective"]]} />
<hr className="api-item-divider" />
#### specifiedDirectives
Full list of stable directives specified by GraphQL.js.
Experimental `@defer` and `@stream` are exported separately and are not
included in this list.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["type", "ReadonlyArray"], "\u003c", ["link", "GraphQLDirective", "/api-v17/type#graphqldirective"], "\u003e"]} />
### Types
#### GraphQLDirectiveExtensions
**Interface.** Custom extensions
**Remarks:** Use a unique identifier name for your extension, for example the name of
your library or project. Do not use a shortened identifier as this increases
the risk of conflicts. We recommend you add at most one extension field,
an object which can contain all the values you need.
<hr className="api-item-divider" />
#### GraphQLDirectiveConfig
**Interface.** Configuration used to construct a GraphQLDirective.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name for this schema element.</td>
</tr>
<tr>
<td>description?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>locations</td>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "DirectiveLocation", "/api-v17/language#directivelocation"], "[]"]} /></td>
<td>Locations where this directive may be applied.</td>
</tr>
<tr>
<td>args?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["type", "ObjMap"], "\u003c", ["link", "GraphQLArgumentConfig", "/api-v17/type#graphqlargumentconfig"], "\u003e\u003e"]} /></td>
<td>Arguments accepted by this field or directive.</td>
</tr>
<tr>
<td>isRepeatable?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "boolean"], "\u003e"]} /></td>
<td>Whether this directive may appear more than once at the same location.</td>
</tr>
<tr>
<td>deprecationReason?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Reason this element is deprecated, if one was provided.</td>
</tr>
<tr>
<td>extensions?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["type", "Readonly"], "\u003c", ["link", "GraphQLDirectiveExtensions", "/api-v17/type#graphqldirectiveextensions"], "\u003e\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "DirectiveDefinitionNode", "/api-v17/language#directivedefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
<tr>
<td>extensionASTNodes?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "readonly"], " ", ["link", "DirectiveExtensionNode", "/api-v17/language#directiveextensionnode"], "[]\u003e"]} /></td>
<td>AST extension nodes applied to this schema element.</td>
</tr>
</tbody>
</table>
## Category: Introspection
<div className="api-category-toc">
<p>
<strong>Functions:</strong><br />
<a href="/api-v17/type#isintrospectiontype">isIntrospectionType()</a>
</p>
<p>
<strong>Constants:</strong><br />
<a href="/api-v17/type#__schema">__Schema</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#__directive">__Directive</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#__directivelocation">__DirectiveLocation</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#__type">__Type</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#__field">__Field</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#__inputvalue">__InputValue</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#__enumvalue">__EnumValue</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#__typekind">__TypeKind</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#schemametafielddef">SchemaMetaFieldDef</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#typemetafielddef">TypeMetaFieldDef</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#typenamemetafielddef">TypeNameMetaFieldDef</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#introspectiontypes">introspectionTypes</a>
</p>
<p>
<strong>Enumerations:</strong><br />
<a href="/api-v17/type#typekind">TypeKind</a>
</p>
</div>
### Functions
#### isIntrospectionType()
Returns true when the type is one of the built-in introspection types.
**Signature:**
<ApiSignature parts={[["name", "isIntrospectionType"], "(", ["parameter", "type"], ": ", ["link", "GraphQLNamedType", "/api-v17/type#graphqlnamedtype"], "): ", ["keyword", "boolean"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["link", "GraphQLNamedType", "/api-v17/type#graphqlnamedtype"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "boolean"]]} /></td>
<td>True when the type is one of the built-in introspection types.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { GraphQLString, isIntrospectionType, __Type } from 'graphql/type';
isIntrospectionType(__Type); // => true
isIntrospectionType(GraphQLString); // => false
```
### Constants
#### __Schema
The introspection type describing a GraphQL schema.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"]]} />
<hr className="api-item-divider" />
#### __Directive
The introspection type describing a GraphQL directive.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"]]} />
<hr className="api-item-divider" />
#### __DirectiveLocation
The introspection enum describing directive locations.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLEnumType", "/api-v17/type#graphqlenumtype"]]} />
<hr className="api-item-divider" />
#### __Type
The introspection type describing GraphQL types.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"]]} />
<hr className="api-item-divider" />
#### __Field
The introspection type describing object and interface fields.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"]]} />
<hr className="api-item-divider" />
#### __InputValue
The introspection type describing arguments and input fields.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"]]} />
<hr className="api-item-divider" />
#### __EnumValue
The introspection type describing enum values.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"]]} />
<hr className="api-item-divider" />
#### __TypeKind
The introspection enum describing GraphQL type kinds.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLEnumType", "/api-v17/type#graphqlenumtype"]]} />
<hr className="api-item-divider" />
#### SchemaMetaFieldDef
Note that these are GraphQLField and not GraphQLFieldConfig,
so the format for args is different.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLField", "/api-v17/type#graphqlfield"], "\u003c", ["keyword", "unknown"], ", ", ["keyword", "unknown"], "\u003e"]} />
<hr className="api-item-divider" />
#### TypeMetaFieldDef
The `__type` meta field definition used by introspection.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLField", "/api-v17/type#graphqlfield"], "\u003c", ["keyword", "unknown"], ", ", ["keyword", "unknown"], "\u003e"]} />
<hr className="api-item-divider" />
#### TypeNameMetaFieldDef
The `__typename` meta field definition used by execution and introspection.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLField", "/api-v17/type#graphqlfield"], "\u003c", ["keyword", "unknown"], ", ", ["keyword", "unknown"], "\u003e"]} />
<hr className="api-item-divider" />
#### introspectionTypes
All introspection types defined by the GraphQL specification.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["type", "ReadonlyArray"], "\u003c", ["link", "GraphQLNamedType", "/api-v17/type#graphqlnamedtype"], "\u003e"]} />
### Enumerations
#### TypeKind
**Enumeration.** The introspection enum describing the different kinds of GraphQL types.
> This is not a TypeScript `enum`. GraphQL.js exports `TypeKind` as both a runtime const object of literal values and a TypeScript type alias for those values.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>{"SCALAR"}</code></td>
<td><code>{"\"SCALAR\""}</code></td>
</tr>
<tr>
<td><code>{"OBJECT"}</code></td>
<td><code>{"\"OBJECT\""}</code></td>
</tr>
<tr>
<td><code>{"INTERFACE"}</code></td>
<td><code>{"\"INTERFACE\""}</code></td>
</tr>
<tr>
<td><code>{"UNION"}</code></td>
<td><code>{"\"UNION\""}</code></td>
</tr>
<tr>
<td><code>{"ENUM"}</code></td>
<td><code>{"\"ENUM\""}</code></td>
</tr>
<tr>
<td><code>{"INPUT_OBJECT"}</code></td>
<td><code>{"\"INPUT_OBJECT\""}</code></td>
</tr>
<tr>
<td><code>{"LIST"}</code></td>
<td><code>{"\"LIST\""}</code></td>
</tr>
<tr>
<td><code>{"NON_NULL"}</code></td>
<td><code>{"\"NON_NULL\""}</code></td>
</tr>
</tbody>
</table>
## Category: Scalars
<div className="api-category-toc">
<p>
<strong>Functions:</strong><br />
<a href="/api-v17/type#isspecifiedscalartype">isSpecifiedScalarType()</a>
</p>
<p>
<strong>Constants:</strong><br />
<a href="/api-v17/type#graphql_max_int">GRAPHQL_MAX_INT</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphql_min_int">GRAPHQL_MIN_INT</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlint">GraphQLInt</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlfloat">GraphQLFloat</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlstring">GraphQLString</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlboolean">GraphQLBoolean</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlid">GraphQLID</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#specifiedscalartypes">specifiedScalarTypes</a>
</p>
</div>
### Functions
#### isSpecifiedScalarType()
Returns true when the scalar type is one of the scalars specified by GraphQL.
**Signature:**
<ApiSignature parts={[["name", "isSpecifiedScalarType"], "(", ["parameter", "type"], ": ", ["link", "GraphQLNamedType", "/api-v17/type#graphqlnamedtype"], "): ", ["keyword", "boolean"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><ApiType parts={[["link", "GraphQLNamedType", "/api-v17/type#graphqlnamedtype"]]} /></td>
<td>The GraphQL type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "boolean"]]} /></td>
<td>True when the scalar type is one of the scalars specified by GraphQL.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import {
GraphQLScalarType,
GraphQLString,
isSpecifiedScalarType,
} from 'graphql/type';
const DateTime = new GraphQLScalarType({
name: 'DateTime',
});
isSpecifiedScalarType(GraphQLString); // => true
isSpecifiedScalarType(DateTime); // => false
```
### Constants
#### GRAPHQL_MAX_INT
Maximum possible Int value as per GraphQL Spec (32-bit signed integer).
n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe up-to 2^53 - 1
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["literal", "2147483647"]]} />
<hr className="api-item-divider" />
#### GRAPHQL_MIN_INT
Minimum possible Int value as per GraphQL Spec (32-bit signed integer).
n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe starting at -(2^53 - 1)
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={["-", ["literal", "2147483648"]]} />
<hr className="api-item-divider" />
#### GraphQLInt
The built-in `Int` scalar type.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLScalarType", "/api-v17/type#graphqlscalartype"], "\u003c", ["keyword", "number"], "\u003e"]} />
<hr className="api-item-divider" />
#### GraphQLFloat
The built-in `Float` scalar type.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLScalarType", "/api-v17/type#graphqlscalartype"], "\u003c", ["keyword", "number"], "\u003e"]} />
<hr className="api-item-divider" />
#### GraphQLString
The built-in `String` scalar type.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLScalarType", "/api-v17/type#graphqlscalartype"], "\u003c", ["keyword", "string"], "\u003e"]} />
<hr className="api-item-divider" />
#### GraphQLBoolean
The built-in `Boolean` scalar type.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLScalarType", "/api-v17/type#graphqlscalartype"], "\u003c", ["keyword", "boolean"], "\u003e"]} />
<hr className="api-item-divider" />
#### GraphQLID
The built-in `ID` scalar type.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["link", "GraphQLScalarType", "/api-v17/type#graphqlscalartype"], "\u003c", ["keyword", "string"], "\u003e"]} />
<hr className="api-item-divider" />
#### specifiedScalarTypes
All built-in scalar types defined by the GraphQL specification.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Type</div>
<ApiType parts={[["type", "ReadonlyArray"], "\u003c", ["link", "GraphQLScalarType", "/api-v17/type#graphqlscalartype"], "\u003e"]} />
## Category: Schema
<div className="api-category-toc">
<p>
<strong>Classes:</strong><br />
<a href="/api-v17/type#graphqlschema">GraphQLSchema</a>
</p>
<p>
<strong>Functions:</strong><br />
<a href="/api-v17/type#isschema">isSchema()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertschema">assertSchema()</a>
</p>
<p>
<strong>Types:</strong><br />
<a href="/api-v17/type#graphqlschemaextensions">GraphQLSchemaExtensions</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#graphqlschemaconfig">GraphQLSchemaConfig</a>
</p>
</div>
### Classes
#### GraphQLSchema
Schema Definition
A Schema is created by supplying the root types of each type of operation,
query and mutation (optional). A schema definition is then supplied to the
validator and executor.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example 1</div>
```ts
const MyAppQueryRootType = new GraphQLObjectType({
name: 'Query',
fields: {
greeting: { type: GraphQLString },
},
});
const MyAppMutationRootType = new GraphQLObjectType({
name: 'Mutation',
fields: {
setGreeting: { type: GraphQLString },
},
});
const MyAppSchema = new GraphQLSchema({
query: MyAppQueryRootType,
mutation: MyAppMutationRootType,
});
```
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example 2</div>
When the schema is constructed, by default only the types that are reachable
by traversing the root types are included, other types must be explicitly
referenced.
```ts
const characterInterface = new GraphQLInterfaceType({
name: 'Character',
fields: {
name: { type: GraphQLString },
},
});
const humanType = new GraphQLObjectType({
name: 'Human',
interfaces: [characterInterface],
fields: {
name: { type: GraphQLString },
},
});
const droidType = new GraphQLObjectType({
name: 'Droid',
interfaces: [characterInterface],
fields: {
name: { type: GraphQLString },
},
});
const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Query',
fields: {
hero: { type: characterInterface },
},
}),
// Since this schema references only the `Character` interface it's
// necessary to explicitly list the types that implement it if
// you want them to be included in the final schema.
types: [humanType, droidType],
});
```
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example 3</div>
If an array of `directives` are provided to GraphQLSchema, that will be the
exact list of directives represented and allowed. If `directives` is not
provided then a default set of the specified directives (e.g. `@include` and
`@skip`) will be used. If you wish to provide *additional* directives to
these specified directives, you must explicitly declare them.
```ts
const MyAppSchema = new GraphQLSchema({
query: MyAppQueryRootType,
directives: specifiedDirectives.concat([myCustomDirective]),
});
```
<hr className="api-subsection-divider" />
##### Constructor
Creates a GraphQLSchema instance.
**Signature:**
<ApiSignature parts={[["keyword", "new"], " ", ["name", "GraphQLSchema"], "(", ["parameter", "config"], ": ", ["type", "Readonly"], "\u003c", ["link", "GraphQLSchemaConfig", "/api-v17/type#graphqlschemaconfig"], "\u003e);"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>config</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c", ["link", "GraphQLSchemaConfig", "/api-v17/type#graphqlschemaconfig"], "\u003e"]} /></td>
<td>Configuration describing this object.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### Members
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>description</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>extensions</td>
<td><ApiType parts={[["type", "Readonly"], "\u003c", ["link", "GraphQLSchemaExtensions", "/api-v17/type#graphqlschemaextensions"], "\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "SchemaDefinitionNode", "/api-v17/language#schemadefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
<tr>
<td>extensionASTNodes</td>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "SchemaExtensionNode", "/api-v17/language#schemaextensionnode"], "[]"]} /></td>
<td>AST extension nodes applied to this schema element.</td>
</tr>
<tr>
<td>assumeValid</td>
<td><ApiType parts={[["keyword", "boolean"]]} /></td>
<td>Whether this schema instance skips validation checks.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
##### getQueryType()
Returns the root object type for query operations.
**Signature:**
<ApiSignature parts={[["name", "getQueryType"], "(): ", ["type", "Maybe"], "\u003c", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "\u003e"]} /></td>
<td>The query root type, if this schema defines one.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
const schema = buildSchema(`
type Query {
greeting: String
}
`);
schema.getQueryType()?.name; // => 'Query'
```
<hr className="api-subsection-divider" />
##### getMutationType()
Returns the root object type for mutation operations.
**Signature:**
<ApiSignature parts={[["name", "getMutationType"], "(): ", ["type", "Maybe"], "\u003c", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "\u003e"]} /></td>
<td>The mutation root type, if this schema defines one.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
const schema = buildSchema(`
type Query {
greeting: String
}
type Mutation {
setGreeting(value: String!): String
}
`);
schema.getMutationType()?.name; // => 'Mutation'
```
<hr className="api-subsection-divider" />
##### getSubscriptionType()
Returns the root object type for subscription operations.
**Signature:**
<ApiSignature parts={[["name", "getSubscriptionType"], "(): ", ["type", "Maybe"], "\u003c", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "\u003e"]} /></td>
<td>The subscription root type, if this schema defines one.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
const schema = buildSchema(`
type Query {
greeting: String
}
type Subscription {
greetings: String
}
`);
schema.getSubscriptionType()?.name; // => 'Subscription'
```
<hr className="api-subsection-divider" />
##### getRootType()
Returns the root object type for the requested operation kind.
**Signature:**
<ApiSignature parts={[["name", "getRootType"], "(\n ", ["parameter", "operation"], ": ", ["link", "OperationTypeNode", "/api-v17/language#operationtypenode"], ",\n): ", ["type", "Maybe"], "\u003c", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>operation</td>
<td><ApiType parts={[["link", "OperationTypeNode", "/api-v17/language#operationtypenode"]]} /></td>
<td>Operation kind to resolve.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "\u003e"]} /></td>
<td>The root object type for the operation kind, if this schema defines one.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { OperationTypeNode } from 'graphql/language';
import { buildSchema } from 'graphql/utilities';
const schema = buildSchema(`
type Query {
greeting: String
}
type Mutation {
setGreeting(value: String!): String
}
`);
schema.getRootType(OperationTypeNode.QUERY)?.name; // => 'Query'
schema.getRootType(OperationTypeNode.MUTATION)?.name; // => 'Mutation'
schema.getRootType(OperationTypeNode.SUBSCRIPTION); // => undefined
```
<hr className="api-subsection-divider" />
##### getTypeMap()
Returns all named types known to this schema.
**Signature:**
<ApiSignature parts={[["name", "getTypeMap"], "(): ", ["type", "ObjMap"], "\u003c", ["link", "GraphQLNamedType", "/api-v17/type#graphqlnamedtype"], "\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "ObjMap"], "\u003c", ["link", "GraphQLNamedType", "/api-v17/type#graphqlnamedtype"], "\u003e"]} /></td>
<td>A map of schema types keyed by type name.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
const schema = buildSchema(`
type User {
name: String
}
type Query {
viewer: User
}
`);
const typeMap = schema.getTypeMap();
typeMap.User.name; // => 'User'
typeMap.Query.name; // => 'Query'
typeMap.String.name; // => 'String'
```
<hr className="api-subsection-divider" />
##### getType()
Returns the named type with the provided name.
**Signature:**
<ApiSignature parts={[["name", "getType"], "(\n ", ["parameter", "name"], ": ", ["keyword", "string"], ",\n): ", ["link", "GraphQLNamedType", "/api-v17/type#graphqlnamedtype"], " \u007c ", ["keyword", "undefined"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name to look up.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLNamedType", "/api-v17/type#graphqlnamedtype"], " \u007c ", ["keyword", "undefined"]]} /></td>
<td>The named schema type, if one exists.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
const schema = buildSchema(`
type User {
name: String
}
type Query {
viewer: User
}
`);
schema.getType('User')?.toString(); // => 'User'
schema.getType('Missing'); // => undefined
```
<hr className="api-subsection-divider" />
##### getPossibleTypes()
Returns object types that may be returned for an abstract type.
**Signature:**
<ApiSignature parts={[["name", "getPossibleTypes"], "(\n ", ["parameter", "abstractType"], ": ", ["link", "GraphQLAbstractType", "/api-v17/type#graphqlabstracttype"], ",\n): ", ["keyword", "readonly"], " ", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "[];"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>abstractType</td>
<td><ApiType parts={[["link", "GraphQLAbstractType", "/api-v17/type#graphqlabstracttype"]]} /></td>
<td>Interface or union type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "[]"]} /></td>
<td>Object types that may satisfy the abstract type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertInterfaceType, assertUnionType } from 'graphql/type';
const schema = buildSchema(`
interface Node {
id: ID!
}
type User implements Node {
id: ID!
}
type Organization implements Node {
id: ID!
}
union SearchResult = User | Organization
type Query {
node: Node
search: [SearchResult]
}
`);
const Node = assertInterfaceType(schema.getType('Node'));
const SearchResult = assertUnionType(schema.getType('SearchResult'));
schema.getPossibleTypes(Node).map((type) => type.name); // => ['User', 'Organization']
schema.getPossibleTypes(SearchResult).map((type) => type.name); // => ['User', 'Organization']
```
<hr className="api-subsection-divider" />
##### getImplementations()
Returns objects and interfaces that implement an interface type.
**Signature:**
<ApiSignature parts={[["name", "getImplementations"], "(", ["parameter", "interfaceType"], ": ", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"], "): \u007b\n ", ["property", "objects"], ": ", ["keyword", "readonly"], " ", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "[];\n ", ["property", "interfaces"], ": ", ["keyword", "readonly"], " ", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"], "[];\n\u007d;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>interfaceType</td>
<td><ApiType parts={[["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"]]} /></td>
<td>Interface type to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={["\u007b\n ", ["property", "objects"], ": ", ["keyword", "readonly"], " ", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "[];\n ", ["property", "interfaces"], ": ", ["keyword", "readonly"], " ", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"], "[];\n\u007d"]} /></td>
<td>Object and interface implementations of the interface.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertInterfaceType } from 'graphql/type';
const schema = buildSchema(`
interface Resource {
url: String!
}
interface Image implements Resource {
url: String!
width: Int
}
type Photo implements Resource & Image {
url: String!
width: Int
}
type Query {
resource: Resource
}
`);
const Resource = assertInterfaceType(schema.getType('Resource'));
const implementations = schema.getImplementations(Resource);
implementations.interfaces.map((type) => type.name); // => ['Image']
implementations.objects.map((type) => type.name); // => ['Photo']
```
<hr className="api-subsection-divider" />
##### isSubType()
Returns whether one type is a possible runtime subtype of an abstract type.
**Signature:**
<ApiSignature parts={[["name", "isSubType"], "(\n ", ["parameter", "abstractType"], ": ", ["link", "GraphQLAbstractType", "/api-v17/type#graphqlabstracttype"], ",\n ", ["parameter", "maybeSubType"], ": ", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], " \u007c ", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"], ",\n): ", ["keyword", "boolean"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>abstractType</td>
<td><ApiType parts={[["link", "GraphQLAbstractType", "/api-v17/type#graphqlabstracttype"]]} /></td>
<td>Interface or union type to inspect.</td>
</tr>
<tr>
<td>maybeSubType</td>
<td><ApiType parts={[["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], " \u007c ", ["link", "GraphQLInterfaceType", "/api-v17/type#graphqlinterfacetype"]]} /></td>
<td>Object or interface type to test as a possible subtype.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "boolean"]]} /></td>
<td>True when the subtype may satisfy the abstract type.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertInterfaceType, assertObjectType } from 'graphql/type';
const schema = buildSchema(`
interface Node {
id: ID!
}
type User implements Node {
id: ID!
}
type Review {
body: String
}
type Query {
node: Node
review: Review
}
`);
const Node = assertInterfaceType(schema.getType('Node'));
const User = assertObjectType(schema.getType('User'));
const Review = assertObjectType(schema.getType('Review'));
schema.isSubType(Node, User); // => true
schema.isSubType(Node, Review); // => false
```
<hr className="api-subsection-divider" />
##### getDirectives()
Returns directives available in this schema.
**Signature:**
<ApiSignature parts={[["name", "getDirectives"], "(): ", ["keyword", "readonly"], " ", ["link", "GraphQLDirective", "/api-v17/type#graphqldirective"], "[];"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "GraphQLDirective", "/api-v17/type#graphqldirective"], "[]"]} /></td>
<td>Directives available in this schema.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
const schema = buildSchema(`
directive @upper on FIELD_DEFINITION
type Query {
greeting: String @upper
}
`);
schema.getDirectives().map((directive) => directive.name); // => ['include', 'skip', 'deprecated', 'specifiedBy', 'oneOf', 'upper']
```
<hr className="api-subsection-divider" />
##### getDirective()
Returns the current directive definition.
**Signature:**
<ApiSignature parts={[["name", "getDirective"], "(\n ", ["parameter", "name"], ": ", ["keyword", "string"], ",\n): ", ["type", "Maybe"], "\u003c", ["link", "GraphQLDirective", "/api-v17/type#graphqldirective"], "\u003e;"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>The GraphQL name to look up.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "GraphQLDirective", "/api-v17/type#graphqldirective"], "\u003e"]} /></td>
<td>The current directive definition, if known.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
const schema = buildSchema(`
directive @upper on FIELD_DEFINITION
type Query {
greeting: String @upper
}
`);
schema.getDirective('upper')?.name; // => 'upper'
schema.getDirective('missing'); // => undefined
```
<hr className="api-subsection-divider" />
##### getField()
This method looks up the field on the given type definition.
It has special casing for the three introspection fields, `__schema`,
`__type` and `__typename`.
`__typename` is special because it can always be queried as a field, even
in situations where no other fields are allowed, like on a Union.
`__schema` and `__type` could get automatically added to the query type,
but that would require mutating type definitions, which would cause issues.
**Signature:**
<ApiSignature parts={[["name", "getField"], "(\n ", ["parameter", "parentType"], ": ", ["link", "GraphQLCompositeType", "/api-v17/type#graphqlcompositetype"], ",\n ", ["parameter", "fieldName"], ": ", ["keyword", "string"], ",\n): ", ["link", "GraphQLField", "/api-v17/type#graphqlfield"], "\u003c", ["keyword", "unknown"], ", ", ["keyword", "unknown"], "\u003e \u007c ", ["keyword", "undefined"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>parentType</td>
<td><ApiType parts={[["link", "GraphQLCompositeType", "/api-v17/type#graphqlcompositetype"]]} /></td>
<td>Composite type to look up the field on.</td>
</tr>
<tr>
<td>fieldName</td>
<td><ApiType parts={[["keyword", "string"]]} /></td>
<td>Field name to look up.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLField", "/api-v17/type#graphqlfield"], "\u003c", ["keyword", "unknown"], ", ", ["keyword", "unknown"], "\u003e \u007c ", ["keyword", "undefined"]]} /></td>
<td>The field definition, including supported introspection fields.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
const schema = buildSchema(`
type Query {
greeting: String
}
`);
const queryType = schema.getQueryType();
schema.getField(queryType, 'greeting')?.name; // => 'greeting'
schema.getField(queryType, '__typename')?.name; // => '__typename'
schema.getField(queryType, 'missing'); // => undefined
```
<hr className="api-subsection-divider" />
##### toConfig()
Returns a normalized configuration object for this object.
The returned config preserves the original `assumeValid` flag so the schema
can be recreated with the same validation behavior.
**Signature:**
<ApiSignature parts={[["name", "toConfig"], "(): ", ["type", "GraphQLSchemaNormalizedConfig"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["type", "GraphQLSchemaNormalizedConfig"]]} /></td>
<td>A configuration object that can be used to recreate this object.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { GraphQLSchema } from 'graphql/type';
const schema = buildSchema(`
type Query {
greeting: String
}
`);
const config = schema.toConfig();
const schemaCopy = new GraphQLSchema(config);
config.query?.name; // => 'Query'
schemaCopy.getQueryType()?.name; // => 'Query'
```
### Functions
#### isSchema()
Test if the given value is a GraphQL schema.
**Signature:**
<ApiSignature parts={[["name", "isSchema"], "(\n ", ["parameter", "schema"], ": ", ["keyword", "unknown"], ",\n): ", ["parameter", "schema"], " ", ["keyword", "is"], " ", ["link", "GraphQLSchema", "/api-v17/type#graphqlschema"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>schema</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>Value to inspect.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["parameter", "schema"], " ", ["keyword", "is"], " ", ["link", "GraphQLSchema", "/api-v17/type#graphqlschema"]]} /></td>
<td>True when the value is a GraphQLSchema.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { GraphQLString, isSchema } from 'graphql/type';
const schema = buildSchema(`
type Query {
greeting: String
}
`);
isSchema(schema); // => true
isSchema(GraphQLString); // => false
```
<hr className="api-item-divider" />
#### assertSchema()
Returns the value as a GraphQLSchema, or throws if it is not a schema.
**Signature:**
<ApiSignature parts={[["name", "assertSchema"], "(", ["parameter", "schema"], ": ", ["keyword", "unknown"], "): ", ["link", "GraphQLSchema", "/api-v17/type#graphqlschema"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>schema</td>
<td><ApiType parts={[["keyword", "unknown"]]} /></td>
<td>GraphQL schema to use.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["link", "GraphQLSchema", "/api-v17/type#graphqlschema"]]} /></td>
<td>The value typed as a GraphQLSchema.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { buildSchema } from 'graphql/utilities';
import { assertSchema, GraphQLString } from 'graphql/type';
const schema = buildSchema(`
type Query {
greeting: String
}
`);
assertSchema(schema); // => schema
assertSchema(GraphQLString); // throws an error
```
### Types
#### GraphQLSchemaExtensions
**Interface.** Custom extensions
**Remarks:** Use a unique identifier name for your extension, for example the name of
your library or project. Do not use a shortened identifier as this increases
the risk of conflicts. We recommend you add at most one extension field,
an object which can contain all the values you need.
<hr className="api-item-divider" />
#### GraphQLSchemaConfig
**Interface.** Configuration used to construct a GraphQLSchema.
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Members</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>description?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "string"], "\u003e"]} /></td>
<td>Human-readable description for this schema element, if provided.</td>
</tr>
<tr>
<td>query?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "\u003e"]} /></td>
<td>Root object type for query operations.</td>
</tr>
<tr>
<td>mutation?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "\u003e"]} /></td>
<td>Root object type for mutation operations.</td>
</tr>
<tr>
<td>subscription?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "GraphQLObjectType", "/api-v17/type#graphqlobjecttype"], "\u003e"]} /></td>
<td>Root object type for subscription operations.</td>
</tr>
<tr>
<td>types?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "readonly"], " ", ["link", "GraphQLNamedType", "/api-v17/type#graphqlnamedtype"], "[]\u003e"]} /></td>
<td>Object types that belong to this union type.</td>
</tr>
<tr>
<td>directives?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "readonly"], " ", ["link", "GraphQLDirective", "/api-v17/type#graphqldirective"], "[]\u003e"]} /></td>
<td>Directives available in this schema or applied to this AST node.</td>
</tr>
<tr>
<td>extensions?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["type", "Readonly"], "\u003c", ["link", "GraphQLSchemaExtensions", "/api-v17/type#graphqlschemaextensions"], "\u003e\u003e"]} /></td>
<td>Extension fields to include in the formatted result.</td>
</tr>
<tr>
<td>astNode?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["link", "SchemaDefinitionNode", "/api-v17/language#schemadefinitionnode"], "\u003e"]} /></td>
<td>AST node from which this schema element was built, if available.</td>
</tr>
<tr>
<td>extensionASTNodes?</td>
<td><ApiType parts={[["type", "Maybe"], "\u003c", ["keyword", "readonly"], " ", ["link", "SchemaExtensionNode", "/api-v17/language#schemaextensionnode"], "[]\u003e"]} /></td>
<td>AST extension nodes applied to this schema element.</td>
</tr>
</tbody>
</table>
## Category: Validation
<div className="api-category-toc">
<p>
<strong>Functions:</strong><br />
<a href="/api-v17/type#validateschema">validateSchema()</a>
<span aria-hidden="true">·</span>
<a href="/api-v17/type#assertvalidschema">assertValidSchema()</a>
</p>
</div>
### Functions
#### validateSchema()
Implements the "Type Validation" sub-sections of the specification's
"Type System" section.
Validation runs synchronously, returning an array of encountered errors, or
an empty array if no errors were encountered and the Schema is valid.
**Signature:**
<ApiSignature parts={[["name", "validateSchema"], "(\n ", ["parameter", "schema"], ": ", ["link", "GraphQLSchema", "/api-v17/type#graphqlschema"], ",\n): ", ["keyword", "readonly"], " ", ["link", "GraphQLError", "/api-v17/error#graphqlerror"], "[];"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>schema</td>
<td><ApiType parts={[["link", "GraphQLSchema", "/api-v17/type#graphqlschema"]]} /></td>
<td>GraphQL schema to use.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Returns</div>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><ApiType parts={[["keyword", "readonly"], " ", ["link", "GraphQLError", "/api-v17/error#graphqlerror"], "[]"]} /></td>
<td>Schema validation errors, or an empty array when the schema is valid.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { validateSchema } from 'graphql/type';
import { buildSchema } from 'graphql/utilities';
const schema = buildSchema(`
type Query {
name: String
}
`);
const errors = validateSchema(schema);
errors; // => []
```
<hr className="api-item-divider" />
#### assertValidSchema()
Utility function which asserts a schema is valid by throwing an error if
it is invalid.
**Signature:**
<ApiSignature parts={[["name", "assertValidSchema"], "(", ["parameter", "schema"], ": ", ["link", "GraphQLSchema", "/api-v17/type#graphqlschema"], "): ", ["keyword", "void"], ";"]} />
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Arguments</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>schema</td>
<td><ApiType parts={[["link", "GraphQLSchema", "/api-v17/type#graphqlschema"]]} /></td>
<td>GraphQL schema to use.</td>
</tr>
</tbody>
</table>
<hr className="api-subsection-divider" />
<div className="api-subsection-title">Example</div>
```ts
import { assertValidSchema } from 'graphql/type';
import { buildSchema } from 'graphql/utilities';
const schema = buildSchema(`
type Query {
name: String
}
`);
assertValidSchema(schema); // does not throw
```