<const Shapes extends StoreShapes>(shapes: Shapes): <
const Base extends StoreContractValue
>(
base: Base
) => StoreContractValue<Base["shapes"] & Shapes, Base["custom"]>
<const Custom extends Readonly<Record<string, unknown>>>(
methods: (shapes: ShapeHandles<StoreShapes>) => Custom
): <const Base extends StoreContractValue>(
base: Base
) => StoreContractValue<Base["shapes"], Base["custom"] & Custom>
<
const Shapes extends StoreShapes,
const Custom extends Readonly<Record<string, unknown>>
>(
shapes: Shapes,
methods: (shapes: ShapeHandles<Shapes>) => Custom
): <const Base extends StoreContractValue>(
base: Base
) => StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>
<const Shapes extends StoreShapes, const Base extends StoreContractValue>(
shapes: Shapes,
base: Base
): StoreContractValue<Base["shapes"] & Shapes, Base["custom"]>
<
const Base extends StoreContractValue,
const Custom extends Readonly<Record<string, unknown>>
>(
methods: (shapes: ShapeHandles<Base["shapes"]>) => Custom,
base: Base
): StoreContractValue<Base["shapes"], Base["custom"] & Custom>
<
const Shapes extends StoreShapes,
const Base extends StoreContractValue,
const Custom extends Readonly<Record<string, unknown>>
>(
shapes: Shapes,
methods: (shapes: ShapeHandles<Base["shapes"] & Shapes>) => Custom,
base: Base
): StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Extend an existing contract with more shapes, more custom methods, or both — the composable counterpart to contract (which builds one from scratch).
Concrete-preservation guarantee. When a methods builder is supplied together with its
base (the data-first forms extend(methods, base) and extend(shapes, methods, base)), the
builder's return Custom is inferred at its exact type and merged as Base["custom"] & Custom.
Each method therefore keeps its precise signature all the way onto effects — e.g.
completed: (entry, success, elapsed) => Effect<void, StoreWriteError, Storage>, never a widened
Record<string, unknown>. The methods builder receives the base's shape handles
(ShapeHandles over Base["shapes"], plus any newly declared shapes), so event.append
/ event.read are typed for the base's own row schemas.
The pipeable / data-last forms (extend(methods) and extend(shapes, methods)) still preserve
the builder's return Custom concretely, but — because the base is not yet known when the
builder is written — its shape handles are typed generically (the newly declared shapes only,
for extend(shapes, methods)). Prefer the data-first forms when methods must read base shapes.
export const const extend: {
<const Shapes extends StoreShapes>(
shapes: Shapes
): <const Base extends StoreContractValue>(
base: Base
) => StoreContractValue<
Base["shapes"] & Shapes,
Base["custom"]
>
<
const Custom extends Readonly<
Record<string, unknown>
>
>(
methods: (
shapes: ShapeHandles<StoreShapes>
) => Custom
): <const Base extends StoreContractValue>(
base: Base
) => StoreContractValue<
Base["shapes"],
Base["custom"] & Custom
>
<
const Shapes extends StoreShapes,
const Custom extends Readonly<
Record<string, unknown>
>
>(
shapes: Shapes,
methods: (
shapes: ShapeHandles<Shapes>
) => Custom
): <const Base extends StoreContractValue>(
base: Base
) => StoreContractValue<
Base["shapes"] & Shapes,
Base["custom"] & Custom
>
<
const Shapes extends StoreShapes,
const Base extends StoreContractValue
>(
shapes: Shapes,
base: Base
): StoreContractValue<
Base["shapes"] & Shapes,
Base["custom"]
>
<
const Base extends StoreContractValue,
const Custom extends Readonly<
Record<string, unknown>
>
>(
methods: (
shapes: ShapeHandles<Base["shapes"]>
) => Custom,
base: Base
): StoreContractValue<
Base["shapes"],
Base["custom"] & Custom
>
<
const Shapes extends StoreShapes,
const Base extends StoreContractValue,
const Custom extends Readonly<
Record<string, unknown>
>
>(
shapes: Shapes,
methods: (
shapes: ShapeHandles<
Base["shapes"] & Shapes
>
) => Custom,
base: Base
): StoreContractValue<
Base["shapes"] & Shapes,
Base["custom"] & Custom
>
}
Extend an existing contract with more shapes, more custom methods, or both — the composable
counterpart to
contract
(which builds one from scratch).
Concrete-preservation guarantee. When a methods builder is supplied together with its
base (the data-first forms extend(methods, base) and extend(shapes, methods, base)), the
builder's return Custom is inferred at its exact type and merged as Base["custom"] & Custom.
Each method therefore keeps its precise signature all the way onto
effects
— e.g.
completed: (entry, success, elapsed) => Effect<void, StoreWriteError, Storage>, never a widened
Record<string, unknown>. The methods builder receives the base's shape handles
(
ShapeHandles
over Base["shapes"], plus any newly declared shapes), so event.append
/ event.read are typed for the base's own row schemas.
The pipeable / data-last forms (extend(methods) and extend(shapes, methods)) still preserve
the builder's return Custom concretely, but — because the base is not yet known when the
builder is written — its shape handles are typed generically (the newly declared shapes only,
for extend(shapes, methods)). Prefer the data-first forms when methods must read base shapes.
extend: {
<const function (type parameter) Shapes in <const Shapes extends StoreShapes>(shapes: Shapes): <const Base extends StoreContractValue>(base: Base) => StoreContractValue<Base["shapes"] & Shapes, Base["custom"]>Shapes extends type StoreShapes = {
readonly [x: string]: StoreShapeInput;
}
StoreShapes>(
shapes: const Shapes extends StoreShapesshapes: function (type parameter) Shapes in <const Shapes extends StoreShapes>(shapes: Shapes): <const Base extends StoreContractValue>(base: Base) => StoreContractValue<Base["shapes"] & Shapes, Base["custom"]>Shapes,
): <const function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"]>Base extends type StoreContractValue<Shapes extends StoreShapes = Readonly<Record<string, StoreShapeInput>>, Custom extends Readonly<Record<string, unknown>> = Readonly<Record<never, never>>> = StoreContractDef<Shapes, Custom> & PipeableStoreContractValue>(
base: const Base extends StoreContractValuebase: function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"]>Base,
) => type StoreContractValue<Shapes extends StoreShapes = Readonly<Record<string, StoreShapeInput>>, Custom extends Readonly<Record<string, unknown>> = Readonly<Record<never, never>>> = StoreContractDef<Shapes, Custom> & PipeableStoreContractValue<function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"]>Base["shapes"] & function (type parameter) Shapes in <const Shapes extends StoreShapes>(shapes: Shapes): <const Base extends StoreContractValue>(base: Base) => StoreContractValue<Base["shapes"] & Shapes, Base["custom"]>Shapes, function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"]>Base["custom"]>;
<const function (type parameter) Custom in <const Custom extends Readonly<Record<string, unknown>>>(methods: (shapes: ShapeHandles<StoreShapes>) => Custom): <const Base extends StoreContractValue>(base: Base) => StoreContractValue<Base["shapes"], Base["custom"] & 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>>>(
methods: (
shapes: ShapeHandles<StoreShapes>
) => Custom
methods: (shapes: ShapeHandles<
Readonly<Record<string, StoreShapeInput>>
>
shapes: type ShapeHandles<Shapes extends StoreShapes> = { readonly [K in keyof Shapes & string as PublicShapeKey<K>]: Shapes[K] extends StoreShapeInputLeaf ? ShapeHandle<NormalizeShape<Shapes[K]>> : Shapes[K] extends StoreShapeTree ? ShapeHandles<Shapes[K]> : never; }Recursive handle tree passed to a contract's methods function: a leaf shape → its
ShapeHandle
({ schema, readPayload, append, read }), a sub-tree → nested
ShapeHandles
. So shapes.sensors.temperature.append navigates the tree.
Underscore-prefixed shapes (e.g. platform _logs) are omitted — same privacy as Effect
_-fields.
ShapeHandles<type StoreShapes = {
readonly [x: string]: StoreShapeInput;
}
StoreShapes>) => function (type parameter) Custom in <const Custom extends Readonly<Record<string, unknown>>>(methods: (shapes: ShapeHandles<StoreShapes>) => Custom): <const Base extends StoreContractValue>(base: Base) => StoreContractValue<Base["shapes"], Base["custom"] & Custom>Custom,
): <const function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"], Base["custom"] & Custom>Base extends type StoreContractValue<Shapes extends StoreShapes = Readonly<Record<string, StoreShapeInput>>, Custom extends Readonly<Record<string, unknown>> = Readonly<Record<never, never>>> = StoreContractDef<Shapes, Custom> & PipeableStoreContractValue>(
base: const Base extends StoreContractValuebase: function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"], Base["custom"] & Custom>Base,
) => type StoreContractValue<Shapes extends StoreShapes = Readonly<Record<string, StoreShapeInput>>, Custom extends Readonly<Record<string, unknown>> = Readonly<Record<never, never>>> = StoreContractDef<Shapes, Custom> & PipeableStoreContractValue<function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"], Base["custom"] & Custom>Base["shapes"], function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"], Base["custom"] & Custom>Base["custom"] & function (type parameter) Custom in <const Custom extends Readonly<Record<string, unknown>>>(methods: (shapes: ShapeHandles<StoreShapes>) => Custom): <const Base extends StoreContractValue>(base: Base) => StoreContractValue<Base["shapes"], Base["custom"] & Custom>Custom>;
<
const function (type parameter) Shapes in <const Shapes extends StoreShapes, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Shapes>) => Custom): <const Base extends StoreContractValue>(base: Base) => StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Shapes extends type StoreShapes = {
readonly [x: string]: StoreShapeInput;
}
StoreShapes,
const function (type parameter) Custom in <const Shapes extends StoreShapes, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Shapes>) => Custom): <const Base extends StoreContractValue>(base: Base) => StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & 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): <const Base extends StoreContractValue>(base: Base) => StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Shapes,
methods: (shapes: ShapeHandles<Shapes>) => Custommethods: (shapes: ShapeHandles<Shapes>shapes: type ShapeHandles<Shapes extends StoreShapes> = { readonly [K in keyof Shapes & string as PublicShapeKey<K>]: Shapes[K] extends StoreShapeInputLeaf ? ShapeHandle<NormalizeShape<Shapes[K]>> : Shapes[K] extends StoreShapeTree ? ShapeHandles<Shapes[K]> : never; }Recursive handle tree passed to a contract's methods function: a leaf shape → its
ShapeHandle
({ schema, readPayload, append, read }), a sub-tree → nested
ShapeHandles
. So shapes.sensors.temperature.append navigates the tree.
Underscore-prefixed shapes (e.g. platform _logs) are omitted — same privacy as Effect
_-fields.
ShapeHandles<function (type parameter) Shapes in <const Shapes extends StoreShapes, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Shapes>) => Custom): <const Base extends StoreContractValue>(base: Base) => StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & 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): <const Base extends StoreContractValue>(base: Base) => StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Custom,
): <const function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Base extends type StoreContractValue<Shapes extends StoreShapes = Readonly<Record<string, StoreShapeInput>>, Custom extends Readonly<Record<string, unknown>> = Readonly<Record<never, never>>> = StoreContractDef<Shapes, Custom> & PipeableStoreContractValue>(
base: const Base extends StoreContractValuebase: function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Base,
) => type StoreContractValue<Shapes extends StoreShapes = Readonly<Record<string, StoreShapeInput>>, Custom extends Readonly<Record<string, unknown>> = Readonly<Record<never, never>>> = StoreContractDef<Shapes, Custom> & PipeableStoreContractValue<function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Base["shapes"] & function (type parameter) Shapes in <const Shapes extends StoreShapes, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Shapes>) => Custom): <const Base extends StoreContractValue>(base: Base) => StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Shapes, function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Base["custom"] & function (type parameter) Custom in <const Shapes extends StoreShapes, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Shapes>) => Custom): <const Base extends StoreContractValue>(base: Base) => StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Custom>;
<const function (type parameter) Shapes in <const Shapes extends StoreShapes, const Base extends StoreContractValue>(shapes: Shapes, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"]>Shapes extends type StoreShapes = {
readonly [x: string]: StoreShapeInput;
}
StoreShapes, const function (type parameter) Base in <const Shapes extends StoreShapes, const Base extends StoreContractValue>(shapes: Shapes, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"]>Base extends type StoreContractValue<Shapes extends StoreShapes = Readonly<Record<string, StoreShapeInput>>, Custom extends Readonly<Record<string, unknown>> = Readonly<Record<never, never>>> = StoreContractDef<Shapes, Custom> & PipeableStoreContractValue>(
shapes: const Shapes extends StoreShapesshapes: function (type parameter) Shapes in <const Shapes extends StoreShapes, const Base extends StoreContractValue>(shapes: Shapes, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"]>Shapes,
base: const Base extends StoreContractValuebase: function (type parameter) Base in <const Shapes extends StoreShapes, const Base extends StoreContractValue>(shapes: Shapes, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"]>Base,
): type StoreContractValue<Shapes extends StoreShapes = Readonly<Record<string, StoreShapeInput>>, Custom extends Readonly<Record<string, unknown>> = Readonly<Record<never, never>>> = StoreContractDef<Shapes, Custom> & PipeableStoreContractValue<function (type parameter) Base in <const Shapes extends StoreShapes, const Base extends StoreContractValue>(shapes: Shapes, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"]>Base["shapes"] & function (type parameter) Shapes in <const Shapes extends StoreShapes, const Base extends StoreContractValue>(shapes: Shapes, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"]>Shapes, function (type parameter) Base in <const Shapes extends StoreShapes, const Base extends StoreContractValue>(shapes: Shapes, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"]>Base["custom"]>;
<
const function (type parameter) Base in <const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(methods: (shapes: ShapeHandles<Base["shapes"]>) => Custom, base: Base): StoreContractValue<Base["shapes"], Base["custom"] & Custom>Base extends type StoreContractValue<Shapes extends StoreShapes = Readonly<Record<string, StoreShapeInput>>, Custom extends Readonly<Record<string, unknown>> = Readonly<Record<never, never>>> = StoreContractDef<Shapes, Custom> & PipeableStoreContractValue,
const function (type parameter) Custom in <const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(methods: (shapes: ShapeHandles<Base["shapes"]>) => Custom, base: Base): StoreContractValue<Base["shapes"], Base["custom"] & 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>>,
>(
methods: (
shapes: ShapeHandles<Base["shapes"]>
) => Custom
methods: (shapes: ShapeHandles<Base["shapes"]>shapes: type ShapeHandles<Shapes extends StoreShapes> = { readonly [K in keyof Shapes & string as PublicShapeKey<K>]: Shapes[K] extends StoreShapeInputLeaf ? ShapeHandle<NormalizeShape<Shapes[K]>> : Shapes[K] extends StoreShapeTree ? ShapeHandles<Shapes[K]> : never; }Recursive handle tree passed to a contract's methods function: a leaf shape → its
ShapeHandle
({ schema, readPayload, append, read }), a sub-tree → nested
ShapeHandles
. So shapes.sensors.temperature.append navigates the tree.
Underscore-prefixed shapes (e.g. platform _logs) are omitted — same privacy as Effect
_-fields.
ShapeHandles<function (type parameter) Base in <const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(methods: (shapes: ShapeHandles<Base["shapes"]>) => Custom, base: Base): StoreContractValue<Base["shapes"], Base["custom"] & Custom>Base["shapes"]>) => function (type parameter) Custom in <const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(methods: (shapes: ShapeHandles<Base["shapes"]>) => Custom, base: Base): StoreContractValue<Base["shapes"], Base["custom"] & Custom>Custom,
base: const Base extends StoreContractValuebase: function (type parameter) Base in <const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(methods: (shapes: ShapeHandles<Base["shapes"]>) => Custom, base: Base): StoreContractValue<Base["shapes"], Base["custom"] & Custom>Base,
): type StoreContractValue<Shapes extends StoreShapes = Readonly<Record<string, StoreShapeInput>>, Custom extends Readonly<Record<string, unknown>> = Readonly<Record<never, never>>> = StoreContractDef<Shapes, Custom> & PipeableStoreContractValue<function (type parameter) Base in <const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(methods: (shapes: ShapeHandles<Base["shapes"]>) => Custom, base: Base): StoreContractValue<Base["shapes"], Base["custom"] & Custom>Base["shapes"], function (type parameter) Base in <const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(methods: (shapes: ShapeHandles<Base["shapes"]>) => Custom, base: Base): StoreContractValue<Base["shapes"], Base["custom"] & Custom>Base["custom"] & function (type parameter) Custom in <const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(methods: (shapes: ShapeHandles<Base["shapes"]>) => Custom, base: Base): StoreContractValue<Base["shapes"], Base["custom"] & Custom>Custom>;
<
const function (type parameter) Shapes in <const Shapes extends StoreShapes, const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Base["shapes"] & Shapes>) => Custom, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Shapes extends type StoreShapes = {
readonly [x: string]: StoreShapeInput;
}
StoreShapes,
const function (type parameter) Base in <const Shapes extends StoreShapes, const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Base["shapes"] & Shapes>) => Custom, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Base extends type StoreContractValue<Shapes extends StoreShapes = Readonly<Record<string, StoreShapeInput>>, Custom extends Readonly<Record<string, unknown>> = Readonly<Record<never, never>>> = StoreContractDef<Shapes, Custom> & PipeableStoreContractValue,
const function (type parameter) Custom in <const Shapes extends StoreShapes, const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Base["shapes"] & Shapes>) => Custom, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & 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 Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Base["shapes"] & Shapes>) => Custom, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Shapes,
methods: (
shapes: ShapeHandles<Base["shapes"] & Shapes>
) => Custom
methods: (shapes: ShapeHandles<Base["shapes"] & Shapes>shapes: type ShapeHandles<Shapes extends StoreShapes> = { readonly [K in keyof Shapes & string as PublicShapeKey<K>]: Shapes[K] extends StoreShapeInputLeaf ? ShapeHandle<NormalizeShape<Shapes[K]>> : Shapes[K] extends StoreShapeTree ? ShapeHandles<Shapes[K]> : never; }Recursive handle tree passed to a contract's methods function: a leaf shape → its
ShapeHandle
({ schema, readPayload, append, read }), a sub-tree → nested
ShapeHandles
. So shapes.sensors.temperature.append navigates the tree.
Underscore-prefixed shapes (e.g. platform _logs) are omitted — same privacy as Effect
_-fields.
ShapeHandles<function (type parameter) Base in <const Shapes extends StoreShapes, const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Base["shapes"] & Shapes>) => Custom, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Base["shapes"] & function (type parameter) Shapes in <const Shapes extends StoreShapes, const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Base["shapes"] & Shapes>) => Custom, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Shapes>) => function (type parameter) Custom in <const Shapes extends StoreShapes, const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Base["shapes"] & Shapes>) => Custom, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Custom,
base: const Base extends StoreContractValuebase: function (type parameter) Base in <const Shapes extends StoreShapes, const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Base["shapes"] & Shapes>) => Custom, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Base,
): type StoreContractValue<Shapes extends StoreShapes = Readonly<Record<string, StoreShapeInput>>, Custom extends Readonly<Record<string, unknown>> = Readonly<Record<never, never>>> = StoreContractDef<Shapes, Custom> & PipeableStoreContractValue<function (type parameter) Base in <const Shapes extends StoreShapes, const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Base["shapes"] & Shapes>) => Custom, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Base["shapes"] & function (type parameter) Shapes in <const Shapes extends StoreShapes, const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Base["shapes"] & Shapes>) => Custom, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Shapes, function (type parameter) Base in <const Shapes extends StoreShapes, const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Base["shapes"] & Shapes>) => Custom, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Base["custom"] & function (type parameter) Custom in <const Shapes extends StoreShapes, const Base extends StoreContractValue, const Custom extends Readonly<Record<string, unknown>>>(shapes: Shapes, methods: (shapes: ShapeHandles<Base["shapes"] & Shapes>) => Custom, base: Base): StoreContractValue<Base["shapes"] & Shapes, Base["custom"] & Custom>Custom>;
} = ((first: unknownfirst: unknown, second: unknownsecond?: unknown, third: unknownthird?: unknown) => {
if (const isMethodsFn: (
value: unknown
) => value is StoreMethodsFn<StoreShapes>
isMethodsFn(first: unknownfirst) && second: unknownsecond === var undefinedundefined) {
return <const function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"] & Readonly<Record<string, StoreShapeInput>>, Base["custom"] | (Base["custom"] & Readonly<...>)>Base extends type StoreContractValue<Shapes extends StoreShapes = Readonly<Record<string, StoreShapeInput>>, Custom extends Readonly<Record<string, unknown>> = Readonly<Record<never, never>>> = StoreContractDef<Shapes, Custom> & PipeableStoreContractValue>(base: const Base extends StoreContractValuebase: function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"] & Readonly<Record<string, StoreShapeInput>>, Base["custom"] | (Base["custom"] & Readonly<...>)>Base) => const extendCore: <Base, Readonly<Record<string, StoreShapeInput>>>(base: Base, shapes?: Readonly<Record<string, StoreShapeInput>> | undefined, methods?: StoreMethodsFn<Base["shapes"] & Readonly<Record<string, StoreShapeInput>>> | undefined) => StoreContractValue<Base["shapes"] & Readonly<Record<string, StoreShapeInput>>, Base["custom"] | (Base["custom"] & Readonly<...>)>extendCore(base: const Base extends StoreContractValuebase, var undefinedundefined, first: StoreMethodsFn<
Readonly<Record<string, StoreShapeInput>>
>
first);
}
if (const isShapeRecord: (
value: unknown
) => value is StoreShapes
isShapeRecord(first: unknownfirst) && const isMethodsFn: (
value: unknown
) => value is StoreMethodsFn<StoreShapes>
isMethodsFn(second: unknownsecond) && third: unknownthird === var undefinedundefined) {
return <const function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"] & Readonly<Record<string, StoreShapeInput>>, Base["custom"] | (Base["custom"] & Readonly<...>)>Base extends type StoreContractValue<Shapes extends StoreShapes = Readonly<Record<string, StoreShapeInput>>, Custom extends Readonly<Record<string, unknown>> = Readonly<Record<never, never>>> = StoreContractDef<Shapes, Custom> & PipeableStoreContractValue>(base: const Base extends StoreContractValuebase: function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"] & Readonly<Record<string, StoreShapeInput>>, Base["custom"] | (Base["custom"] & Readonly<...>)>Base) =>
const extendCore: <Base, Readonly<Record<string, StoreShapeInput>>>(base: Base, shapes?: Readonly<Record<string, StoreShapeInput>> | undefined, methods?: StoreMethodsFn<Base["shapes"] & Readonly<Record<string, StoreShapeInput>>> | undefined) => StoreContractValue<Base["shapes"] & Readonly<Record<string, StoreShapeInput>>, Base["custom"] | (Base["custom"] & Readonly<...>)>extendCore(base: const Base extends StoreContractValuebase, first: Readonly<
Record<string, StoreShapeInput>
>
first, second: StoreMethodsFn<
Readonly<Record<string, StoreShapeInput>>
>
second as type StoreMethodsFn<Shapes extends StoreShapes> = (shapes: ShapeHandles<Shapes>) => Readonly<Record<string, unknown>>StoreMethodsFn<function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"] & Readonly<Record<string, StoreShapeInput>>, Base["custom"] | (Base["custom"] & Readonly<...>)>Base["shapes"] & typeof first: Readonly<
Record<string, StoreShapeInput>
>
first>);
}
if (const isShapeRecord: (
value: unknown
) => value is StoreShapes
isShapeRecord(first: unknownfirst) && second: unknownsecond === var undefinedundefined) {
return <const function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"] & Readonly<Record<string, StoreShapeInput>>, Base["custom"] | (Base["custom"] & Readonly<...>)>Base extends type StoreContractValue<Shapes extends StoreShapes = Readonly<Record<string, StoreShapeInput>>, Custom extends Readonly<Record<string, unknown>> = Readonly<Record<never, never>>> = StoreContractDef<Shapes, Custom> & PipeableStoreContractValue>(base: const Base extends StoreContractValuebase: function (type parameter) Base in <const Base extends StoreContractValue>(base: Base): StoreContractValue<Base["shapes"] & Readonly<Record<string, StoreShapeInput>>, Base["custom"] | (Base["custom"] & Readonly<...>)>Base) => const extendCore: <Base, Readonly<Record<string, StoreShapeInput>>>(base: Base, shapes?: Readonly<Record<string, StoreShapeInput>> | undefined, methods?: StoreMethodsFn<Base["shapes"] & Readonly<Record<string, StoreShapeInput>>> | undefined) => StoreContractValue<Base["shapes"] & Readonly<Record<string, StoreShapeInput>>, Base["custom"] | (Base["custom"] & Readonly<...>)>extendCore(base: const Base extends StoreContractValuebase, first: Readonly<
Record<string, StoreShapeInput>
>
first);
}
if (const isMethodsFn: (
value: unknown
) => value is StoreMethodsFn<StoreShapes>
isMethodsFn(first: unknownfirst) && function isStoreContractValue(value: unknown): value is StoreContractValueisStoreContractValue(second: unknownsecond)) {
return const extendCore: <StoreContractValue<Readonly<Record<string, StoreShapeInput>>, Readonly<Record<never, never>>>, Readonly<Record<string, StoreShapeInput>>>(base: StoreContractValue<Readonly<Record<string, StoreShapeInput>>, Readonly<Record<never, never>>>, shapes?: Readonly<Record<string, StoreShapeInput>> | undefined, methods?: StoreMethodsFn<...> | undefined) => StoreContractValue<...>extendCore(second: StoreContractValue<
Readonly<Record<string, StoreShapeInput>>,
Readonly<Record<never, never>>
>
second, var undefinedundefined, first: StoreMethodsFn<
Readonly<Record<string, StoreShapeInput>>
>
first);
}
if (const isShapeRecord: (
value: unknown
) => value is StoreShapes
isShapeRecord(first: unknownfirst) && const isMethodsFn: (
value: unknown
) => value is StoreMethodsFn<StoreShapes>
isMethodsFn(second: unknownsecond) && function isStoreContractValue(value: unknown): value is StoreContractValueisStoreContractValue(third: unknownthird)) {
return const extendCore: <StoreContractValue<Readonly<Record<string, StoreShapeInput>>, Readonly<Record<never, never>>>, Readonly<Record<string, StoreShapeInput>>>(base: StoreContractValue<Readonly<Record<string, StoreShapeInput>>, Readonly<Record<never, never>>>, shapes?: Readonly<Record<string, StoreShapeInput>> | undefined, methods?: StoreMethodsFn<...> | undefined) => StoreContractValue<...>extendCore(third: StoreContractValue<
Readonly<Record<string, StoreShapeInput>>,
Readonly<Record<never, never>>
>
third, first: Readonly<
Record<string, StoreShapeInput>
>
first, second: StoreMethodsFn<
Readonly<Record<string, StoreShapeInput>>
>
second);
}
if (const isShapeRecord: (
value: unknown
) => value is StoreShapes
isShapeRecord(first: unknownfirst) && function isStoreContractValue(value: unknown): value is StoreContractValueisStoreContractValue(second: unknownsecond)) {
return const extendCore: <StoreContractValue<Readonly<Record<string, StoreShapeInput>>, Readonly<Record<never, never>>>, Readonly<Record<string, StoreShapeInput>>>(base: StoreContractValue<Readonly<Record<string, StoreShapeInput>>, Readonly<Record<never, never>>>, shapes?: Readonly<Record<string, StoreShapeInput>> | undefined, methods?: StoreMethodsFn<...> | undefined) => StoreContractValue<...>extendCore(second: StoreContractValue<
Readonly<Record<string, StoreShapeInput>>,
Readonly<Record<never, never>>
>
second, first: Readonly<
Record<string, StoreShapeInput>
>
first);
}
throw new var Error: ErrorConstructor
new (message?: string, options?: ErrorOptions) => Error (+1 overload)
Error("Store.extend: invalid arguments");
}) as never;