import { AnnotationSpec, CircleAnnotationSpec, DotAnnotationSpec, Note, NoteCanvas, NoteSvg, RectAnnotationSpec, } from './types' import { isValidElement } from 'react' export const isSvgNote = (note: Note): note is NoteSvg => { const noteType = typeof note return ( isValidElement(note) || noteType === 'string' || noteType === 'function' || noteType === 'object' ) } export const isCanvasNote = (note: Note): note is NoteCanvas => { const noteType = typeof note return noteType === 'string' || noteType === 'function' } export const isCircleAnnotation = ( annotationSpec: AnnotationSpec ): annotationSpec is CircleAnnotationSpec => annotationSpec.type === 'circle' export const isDotAnnotation = ( annotationSpec: AnnotationSpec ): annotationSpec is DotAnnotationSpec => annotationSpec.type === 'dot' export const isRectAnnotation = ( annotationSpec: AnnotationSpec ): annotationSpec is RectAnnotationSpec => annotationSpec.type === 'rect'