excalidraw/src/element/typeChecks.ts

19 lines
485 B
TypeScript
Raw Normal View History

import { ExcalidrawElement, ExcalidrawTextElement } from "./types";
export function isTextElement(
2020-01-24 12:04:54 +02:00
element: ExcalidrawElement,
): element is ExcalidrawTextElement {
return element.type === "text";
}
export function isExcalidrawElement(element: any): boolean {
return (
element?.type === "text" ||
element?.type === "diamond" ||
element?.type === "rectangle" ||
element?.type === "ellipse" ||
element?.type === "arrow" ||
element?.type === "line"
);
}