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