TLUnknownShape

See source code

A type for a shape that is available in the editor but whose type is unknown—either one of the editor's default shapes or else a custom shape.

This is useful when working with shapes generically without knowing their specific type. The shape type is a string and props are a generic object.

type TLUnknownShape = TLBaseShape<string, object>

Example

// Handle any shape regardless of its specific type
function processUnknownShape(shape: TLUnknownShape) {
  console.log(`Processing shape of type: ${shape.type}`)
  console.log(`Position: (${shape.x}, ${shape.y})`)
}
Prev
TLUnknownBinding
Next
TLVideoAsset