Hyperlinkv0.8.0-beta.28

Store

Store.contractconstsrc/Store.ts:687
<const Shapes extends StoreShapes>(
  shapes: Shapes
): StoreContractValue<Shapes>
<
  const Shapes extends StoreShapes,
  const Custom extends Readonly<Record<string, unknown>>
>(
  shapes: Shapes,
  methods: (shapes: ShapeHandles<Shapes>) => Custom
): StoreContractValue<Shapes, Custom>

Declare store shapes and optional custom methods.

Part 1 declares row shapes (each becomes store.<shape>.append / .read with the baked-in read payload). Part 2 optionally adds flat aliases, bare Effects, or effect functions — not readWith helpers.

constructors
Source src/Store.ts:68715 lines
export const contract: {
  <const Shapes extends StoreShapes>(
    shapes: Shapes,
  ): StoreContractValue<Shapes>;
  <
    const Shapes extends StoreShapes,
    const Custom extends Readonly<Record<string, unknown>>,
  >(
    shapes: Shapes,
    methods: (shapes: ShapeHandles<Shapes>) => Custom,
  ): StoreContractValue<Shapes, Custom>;
} = ((shapes: StoreShapes, methods?: (handles: ShapeHandles<StoreShapes>) => Readonly<Record<string, unknown>>) =>
  methods === undefined
    ? makeStoreContractValue(shapes)
    : makeStoreContractValue(shapes, methods)) as never;