<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 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>
}
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.
contract: {
<const function (type parameter) Shapes in <const Shapes extends StoreShapes>(shapes: Shapes): StoreContractValue<Shapes>Shapes extends import StoreShapesStoreShapes>(
shapes: const Shapes extends StoreShapesshapes: function (type parameter) Shapes in <const Shapes extends StoreShapes>(shapes: Shapes): StoreContractValue<Shapes>Shapes,
): import StoreContractValueStoreContractValue<function (type parameter) Shapes in <const Shapes extends StoreShapes>(shapes: Shapes): StoreContractValue<Shapes>Shapes>;
<
const function (type parameter) Shapes in <const Shapes extends StoreShapes, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Shapes>) => Custom): StoreContractValue<Shapes, Custom>Shapes extends import StoreShapesStoreShapes,
const function (type parameter) Custom in <const Shapes extends StoreShapes, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Shapes>) => Custom): StoreContractValue<Shapes, Custom>Custom extends type Readonly<T> = {
readonly [P in keyof T]: T[P]
}
Make all properties in T readonly
Readonly<type Record<K extends keyof any, T> = {
[P in K]: T
}
Construct a type with a set of properties K of type T
Record<string, unknown>>,
>(
shapes: const Shapes extends StoreShapesshapes: function (type parameter) Shapes in <const Shapes extends StoreShapes, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Shapes>) => Custom): StoreContractValue<Shapes, Custom>Shapes,
methods: (shapes: ShapeHandles<Shapes>) => Custommethods: (shapes: ShapeHandles<Shapes>shapes: import ShapeHandlesShapeHandles<function (type parameter) Shapes in <const Shapes extends StoreShapes, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Shapes>) => Custom): StoreContractValue<Shapes, Custom>Shapes>) => function (type parameter) Custom in <const Shapes extends StoreShapes, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Shapes>) => Custom): StoreContractValue<Shapes, Custom>Custom,
): import StoreContractValueStoreContractValue<function (type parameter) Shapes in <const Shapes extends StoreShapes, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Shapes>) => Custom): StoreContractValue<Shapes, Custom>Shapes, function (type parameter) Custom in <const Shapes extends StoreShapes, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Shapes>) => Custom): StoreContractValue<Shapes, Custom>Custom>;
} = ((shapes: StoreShapesshapes: import StoreShapesStoreShapes, methods: | ((
handles: ShapeHandles<StoreShapes>
) => Readonly<Record<string, unknown>>)
| undefined
methods?: (handles: ShapeHandles<StoreShapes>handles: import ShapeHandlesShapeHandles<import StoreShapesStoreShapes>) => type Readonly<T> = {
readonly [P in keyof T]: T[P]
}
Make all properties in T readonly
Readonly<type Record<K extends keyof any, T> = {
[P in K]: T
}
Construct a type with a set of properties K of type T
Record<string, unknown>>) =>
methods: | ((
handles: ShapeHandles<StoreShapes>
) => Readonly<Record<string, unknown>>)
| undefined
methods === var undefinedundefined
? import makeStoreContractValuemakeStoreContractValue(shapes: StoreShapesshapes)
: import makeStoreContractValuemakeStoreContractValue(shapes: StoreShapesshapes, methods: (
handles: ShapeHandles<StoreShapes>
) => Readonly<Record<string, unknown>>
methods)) as never;