UtilsAPI.isShape

Returns true if the given value is a Shape.

UtilsAPI.isShape() method

Returns true if the given value is a Shape.

Signature:

isShape(node: Layer | Shape): node is Shape;

Parameters

Parameter

Type

Description

node

Layer | Shape

The value to check

Returns:

node is Shape

true if node is a Shape, otherwise false.

Example

for (const node of creator.selection.nodes) {
  if (creator.utils.isShape(node)) {
    // node is narrowed to Shape
    console.log(node.type);
  }
}
Last updated: October 8, 2026 at 10:45 AMEdit this page