TLShapePartial

See source code

A partial version of a shape, useful for updates and patches.

This type represents a shape where all properties except id and type are optional. It's commonly used when updating existing shapes or creating shape patches.

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

Example

// Update a shape's position
const shapeUpdate: TLShapePartial = {
  id: "shape:123",
  type: "geo",
  x: 100,
  y: 200,
};

// Update shape properties
const propsUpdate: TLShapePartial<TLGeoShape> = {
  id: "shape:123",
  type: "geo",
  props: {
    w: 150,
    h: 100,
  },
};
Prev
TLShapeId
Next
TLStore