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