Skip to content

Commit

Permalink
[field] Use isTypedObject from @sanity/types
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Oct 6, 2020
1 parent 92ac20f commit ff93ea0
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/@sanity/field/src/schema/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {TypedObject} from '@sanity/types'
import schema from 'part:@sanity/base/schema'
import {isTypedObject} from '@sanity/types'
import {Diff, ArraySchemaType, SchemaType, ReferenceSchemaType} from '../diff'

export function getReferencedType(referenceType: ReferenceSchemaType): SchemaType | undefined {
Expand Down Expand Up @@ -63,10 +63,6 @@ function resolveArrayMemberType(
return schemaType.of.length === 1 ? schemaType.of[0] : undefined
}

function isTypedObject(val: unknown): val is TypedObject {
return typeof val === 'object' && val !== null && typeof (val as TypedObject)._type === 'string'
}

function resolveJSType(val: unknown) {
if (Array.isArray(val)) {
return 'array'
Expand Down

0 comments on commit ff93ea0

Please sign in to comment.