@portabletext/editor
Version:
Portable Text Editor made in React
13 lines (11 loc) • 306 B
text/typescript
import type {PortableTextChild, PortableTextSpan} from '@sanity/types'
import type {EditorContext} from '..'
/**
* @public
*/
export function isSpan(
context: Pick<EditorContext, 'schema'>,
child: PortableTextChild,
): child is PortableTextSpan {
return child._type === context.schema.span.name
}