TLCreateShapePartial

See source code

A partial version of a shape, useful for creating shapes.

This type represents a shape where all properties except type are optional. It's commonly used when creating shapes.

type TLCreateShapePartial<T extends TLShape = TLShape> = T extends T
  ? {
      meta?: Partial<T["meta"]>;
      props?: Partial<T["props"]>;
      type: T["type"];
    } & Partial<Omit<T, "meta" | "props" | "type">>
  : never;

Example

// Create a shape
const shapeCreate: TLCreateShapePartial = {
  type: "geo",
  x: 100,
  y: 200,
};

// Create shape properties
const propsCreate: TLCreateShapePartial<TLGeoShape> = {
  type: "geo",
  props: {
    w: 150,
    h: 100,
  },
};
Prev
TLCanvasUiColor
Next
TLCursorType