UtilsAPI.isShape
Type guard that returns true when the given node is a Shape.
UtilsAPI.isShape method
Type guard that returns true when the given node is a Shape (RECTANGLE, ELLIPSE, POLYGON, STAR, PATH, or GROUP).
Signature:
isShape(node: Layer | Shape): node is Shape;Parameters
Parameter | Type | Description |
|---|---|---|
node | The node to test. |
Returns: node is Shape
A TypeScript type predicate. When true, the compiler narrows node to Shape in the calling scope.
Example
for (const node of creator.selection.nodes) {
if (creator.utils.isShape(node)) {
// `node` is narrowed to Shape here
console.log(node.type);
}
}Last updated: August 5, 2026 at 11:47 AMEdit this page