Skip to content

Commit

Permalink
feat(types): add isArraySchemaType asserter
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoerge committed Apr 28, 2021
1 parent 7bce53c commit ea7446a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/@sanity/types/src/schema/asserters.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import {ObjectSchemaType, ReferenceSchemaType, SchemaType, TitledListValue} from './types'
import {
ArraySchemaType,
ObjectSchemaType,
ReferenceSchemaType,
SchemaType,
TitledListValue,
} from './types'

export function isObjectSchemaType(type: SchemaType): type is ObjectSchemaType {
return type.jsonType === 'object'
}

export function isArraySchemaType(type: SchemaType): type is ArraySchemaType {
return type.jsonType === 'array'
}

export function isReferenceSchemaType(
type: SchemaType | ReferenceSchemaType
): type is ReferenceSchemaType {
Expand Down

0 comments on commit ea7446a

Please sign in to comment.