v16 APIgraphql/typeIntrospection

graphql/type/introspection

Functions

isIntrospectionType()

Returns true when the type is one of the built-in introspection types.

Signature:

isIntrospectionType(type: GraphQLNamedType): boolean

Arguments

NameTypeDescription
typeGraphQLNamedTypeThe GraphQL type to inspect.

Returns

TypeDescription
booleanTrue when the value matches this type.

Example

import { isIntrospectionType, GraphQLString } from 'graphql/type';
 
const result = isIntrospectionType(GraphQLString);
 
// result: true for matching GraphQL types

Constants

__Schema

The introspection type describing a GraphQL schema.

GraphQLObjectType

__Directive

The introspection type describing a GraphQL directive.

GraphQLObjectType

__DirectiveLocation

The introspection enum describing directive locations.

GraphQLEnumType

__Type

The introspection type describing GraphQL types.

GraphQLObjectType

__Field

The introspection type describing object and interface fields.

GraphQLObjectType

__InputValue

The introspection type describing arguments and input fields.

GraphQLObjectType

__EnumValue

The introspection type describing enum values.

GraphQLObjectType

__TypeKind

The introspection enum describing GraphQL type kinds.

GraphQLEnumType

SchemaMetaFieldDef

Note that these are GraphQLField and not GraphQLFieldConfig, so the format for args is different.

GraphQLField<unknown, unknown>

TypeMetaFieldDef

The __type meta field definition used by introspection.

GraphQLField<unknown, unknown>

TypeNameMetaFieldDef

The __typename meta field definition used by execution and introspection.

GraphQLField<unknown, unknown>

introspectionTypes

All introspection types defined by the GraphQL specification.

ReadonlyArray<GraphQLNamedType>

Enumerations

TypeKind

The introspection enum describing the different kinds of GraphQL types.

Members

NameValueDescription
SCALAR"SCALAR"A scalar type.
OBJECT"OBJECT"An object type.
INTERFACE"INTERFACE"An interface type.
UNION"UNION"A union type.
ENUM"ENUM"An enum type.
INPUT_OBJECT"INPUT_OBJECT"An input object type.
LIST"LIST"A list wrapper type.
NON_NULL"NON_NULL"A non-null wrapper type.