cleanup
This commit is contained in:
parent
4d4a5dde50
commit
9772ce4bec
15
src/Updux.ts
15
src/Updux.ts
@ -25,17 +25,6 @@ export type DuxStateSubduxes<C extends {}> = keyof C extends never
|
|||||||
? unknown
|
? unknown
|
||||||
: { [K in keyof C]: StateOf<C[K]> };
|
: { [K in keyof C]: StateOf<C[K]> };
|
||||||
|
|
||||||
// type UnionArrayTypes<A extends any[]> = A[number];
|
|
||||||
|
|
||||||
// type ActionType<A extends ActionGenerator> = A extends ActionGenerator<infer B> ? B : never;
|
|
||||||
|
|
||||||
// type ActionAsObject<A extends ActionGenerator> = Record< ActionType<A>, A > }>;
|
|
||||||
|
|
||||||
// type UnionToIntersection<U> =
|
|
||||||
// (U extends any ? (k: U)=>void : never) extends ((k: infer I)=>void) ? I : never
|
|
||||||
|
|
||||||
// type ActionsAsObject<A extends ActionGenerator[]> = ActionAsObject< A[number]>
|
|
||||||
|
|
||||||
export class Updux<TState extends any = {}, TActions extends { [key: string]: ActionGenerator } = {}, TSubduxes = {}> {
|
export class Updux<TState extends any = {}, TActions extends { [key: string]: ActionGenerator } = {}, TSubduxes = {}> {
|
||||||
#localInitial: any = {};
|
#localInitial: any = {};
|
||||||
#subduxes;
|
#subduxes;
|
||||||
@ -52,10 +41,6 @@ export class Updux<TState extends any = {}, TActions extends { [key: string]: Ac
|
|||||||
return this.#actions;
|
return this.#actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
get action(): ActionsAsObject<TActions> {
|
|
||||||
return Object.fromEntries(this.#actions.map( a => [ a.type, a ] ));
|
|
||||||
}
|
|
||||||
|
|
||||||
get initial(): TState & DuxStateSubduxes<TSubduxes> {
|
get initial(): TState & DuxStateSubduxes<TSubduxes> {
|
||||||
if (Object.keys(this.#subduxes).length === 0) return this.#localInitial;
|
if (Object.keys(this.#subduxes).length === 0) return this.#localInitial;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user