Skip to main content

guard

Custom GraphQL type guards and property guards.

instanceOf()​

function instanceOf<T>(obj, type): obj is Function

Checks if a GraphQL named type is of generic type T.

Type Parameters​

β€’ T

a GraphQL type to check against, eg GraphQLObjectType.

Parameters​

β€’ obj: unknown

a GraphQL named type from the GraphQL schema.

β€’ type

the GraphQL type T.

Returns​

obj is Function

Defined in​

packages/graphql/src/guard.ts:58


isApiType()​

function isApiType(type): boolean

Checks if a type belongs to API (operation related).

Parameters​

β€’ type: unknown

a GraphQL type.

Returns​

boolean

Defined in​

packages/graphql/src/guard.ts:104


isDeprecated()​

function isDeprecated<T>(obj): obj is DeprecatedType<T>

Checks if a GraphQL named type is deprecated.

Type Parameters​

β€’ T

a GraphQL type to check against, eg GraphQLObjectType.

Parameters​

β€’ obj: T

an instance of T.

Returns​

obj is DeprecatedType<T>

Defined in​

packages/graphql/src/guard.ts:79


isGraphQLFieldType()​

function isGraphQLFieldType(type): type is GraphQLField<unknown, unknown, unknown>

Checks if a GraphQL named type is of type GraphQLField.

Parameters​

β€’ type: unknown

a GraphQL type.

Returns​

type is GraphQLField<unknown, unknown, unknown>

Defined in​

packages/graphql/src/guard.ts:39


isOperation()​

function isOperation(type): type is GraphQLOperationType

Checks if a GraphQL type a GraphQL operation (query, mutation, subscription).

Parameters​

β€’ type: unknown

a GraphQL type.

Returns​

type is GraphQLOperationType

Defined in​

packages/graphql/src/guard.ts:94


isSystemType()​

function isSystemType(type): boolean

Checks if a type belongs to schema (schema type definition excluding operations related types).

Parameters​

β€’ type: unknown

a GraphQL type.

Returns​

boolean

Defined in​

packages/graphql/src/guard.ts:117