StoreDecoration<R extends string, S extends Record<R, any>, EM extends EventMapBase>

interface
types.ts:2139

The registration surface whose return types carry the widening.

Every method returns the **same runtime object**, re-typed. Subscriptions, effects, middleware, the dedup cache, both buses and any in-flight call() are untouched; the only runtime effect is the registration itself. Note there is no explicit type parameter for the added event map anywhere. It is inferred from a single value position, so the partial-inference problem never arises and no call site needs a type argument or a cast.

Type parameters

NameTypeDescription
Rextends string
Sextends Record<R, any>
EMextends EventMapBase

Methods

registerSlice

Mounts a slice and hands back both the widened store and a disposer. The disposer is **library-private**: after it runs, the widened type still promises a slice that is gone. Application code should take StoreDecoration.withSlice instead, which returns no disposer at all.

signature
registerSlice<N, Spec>(name, spec, options?): Unsubscribe & { store: WidenedSlice<R, S, EM, N, Spec>; dispose: unknown }

Mounts a slice and hands back both the widened store and a disposer. The disposer is **library-private**: after it runs, the widened type still promises a slice that is gone. Application code should take StoreDecoration.withSlice instead, which returns no disposer at all.

Type parameters

NameTypeDescription
Nextends string
Specextends ReducerSpec<any, any>

Parameters

NameTypeDescription
nameN
NameTypeDescription
specSpec

options, object with:

NameTypeDescription
owner?string

Returns

Unsubscribe & { store: WidenedSlice<R, S, EM, N, Spec>; dispose: unknown }

withEffect

Registers an effect and returns the store widened by whatever event map it declares.

signature
withEffect<Spec>(spec): DecoratableStore<R, S, Merge<EM, EMAddOf<Spec>>>

Registers an effect and returns the store widened by whatever event map it declares.

Type parameters

NameTypeDescription
Specextends EffectSpec<any, any>

Parameters

NameTypeDescription
specSpec

Returns

DecoratableStore<R, S, Merge<EM, EMAddOf<Spec>>>

withMiddleware

Registers middleware and returns the store widened by whatever event map it declares. Only the **spec form** can widen: MiddlewareFunction's event parameter is EventUnion<EM>, a mapped type TypeScript cannot infer EM back out of. A bare function therefore contributes {}.

signature
withMiddleware<M>(mw): DecoratableStore<R, S, Merge<EM, EMAddOf<M>>>

Registers middleware and returns the store widened by whatever event map it declares. Only the **spec form** can widen: MiddlewareFunction's event parameter is EventUnion<EM>, a mapped type TypeScript cannot infer EM back out of. A bare function therefore contributes {}.

Type parameters

NameTypeDescription
Mextends MiddlewareInput<any, any>

Parameters

NameTypeDescription
mwM

Returns

DecoratableStore<R, S, Merge<EM, EMAddOf<M>>>

withSlice

Mounts a slice and returns the widened store, for chaining.

signature
withSlice<N, Spec>(name, spec, options?): WidenedSlice<R, S, EM, N, Spec>

Mounts a slice and returns the widened store, for chaining.

Type parameters

NameTypeDescription
Nextends string
Specextends ReducerSpec<any, any>

Parameters

NameTypeDescription
nameN
NameTypeDescription
specSpec

options, object with:

NameTypeDescription
owner?string

Returns

WidenedSlice<R, S, EM, N, Spec>