import { Editor, TLShape, TLShapePartial } from "tldraw"; /** * @returns true if the shape is of the given type * @example * ```ts * isShapeOfType(shape, 'arrow') * ``` */ export function isShapeOfType(shape: TLShape, type: T['type']): shape is T { return shape.type === type; } export function updateProps(editor: Editor, shape: T, props: Partial) { editor.updateShape({ ...shape, props: { ...shape.props, ...props }, } as TLShapePartial) }