isShape

See source code

Type guard to check if a record is a shape.

function isShape(record?: UnknownRecord): record is TLShape;

Example

const record = store.get("shape:abc123");
if (isShape(record)) {
  console.log(`Shape type: ${record.type}`);
  console.log(`Position: (${record.x}, ${record.y})`);
}

Parameters

NameDescription

record

The record to check

Returns

record is TLShape;

True if the record is a shape, false otherwise

Prev
isPageId
Next
isShapeId