guard
Custom GraphQL type guards and property guards.
executableDirectiveLocation()β
function executableDirectiveLocation(directive): boolean
Checks if a directive is executable (related to operations).
Parametersβ
directiveβ
GraphQLDirective
Returnsβ
boolean
Defined inβ
packages/graphql/src/guard.ts:104
instanceOf()β
function instanceOf<T>(obj, type): obj is () => T
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β
() => T
the GraphQL type T
.
Returnsβ
obj is () => T
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:140
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:153
typeSystemDirectiveLocation()β
function typeSystemDirectiveLocation(directive): boolean
Checks if a directive is system (related to schema definition).
Parametersβ
directiveβ
GraphQLDirective
Returnsβ
boolean
Defined inβ
packages/graphql/src/guard.ts:127