redux-state-branch
Advanced tools
Comparing version 0.0.39 to 0.0.40
@@ -137,7 +137,9 @@ interface AnyAction<T = any> { | ||
} | ||
export declare class StateBranch<ItemT extends AnyItem, BranchStateT extends State<ItemT>, ActionsT extends Actions<ItemT, BranchStateT> | { | ||
[key: string]: (...args: any) => AnyAction; | ||
}, SelectorsT extends Selectors<ItemT, BranchStateT> | { | ||
[key: string]: (...args: any) => any; | ||
}, ConstantsT extends { | ||
declare type ActionsMap = { | ||
[key: string]: Function; | ||
} & ReturnType<typeof actionsFactory>; | ||
declare type SelectorsMap = { | ||
[key: string]: Function; | ||
} & ReturnType<typeof selectorsFactory>; | ||
export declare class StateBranch<ItemT extends AnyItem, BranchStateT extends State<ItemT>, ActionsT extends Actions<ItemT, BranchStateT> | ActionsMap, SelectorsT extends Selectors<ItemT, BranchStateT> | SelectorsMap, ConstantsT extends { | ||
[key: string]: string; | ||
@@ -155,6 +157,6 @@ }, UtilsT extends { | ||
protected extendedReducer: any; | ||
constructor({ name, actions: ActionsConstructor, selectors: SelectorsConstructor, constants, utils, defaultItem, defaultState, reducer, generateId: customGenerateIdFunc }: { | ||
constructor({ name, actions: ActionsArg, selectors: SelectorsArg, constants, utils, defaultItem, defaultState, reducer, generateId: customGenerateIdFunc }: { | ||
name: string; | ||
actions?: ActionsT | (new (...args: any) => ActionsT); | ||
selectors?: SelectorsT | (new (name: string) => SelectorsT); | ||
selectors?: SelectorsT | (new (...args: any) => SelectorsT); | ||
constants?: ConstantsT; | ||
@@ -161,0 +163,0 @@ utils?: UtilsT; |
@@ -193,3 +193,3 @@ "use strict"; | ||
function StateBranch(_a) { | ||
var name = _a.name, _b = _a.actions, ActionsConstructor = _b === void 0 ? Actions : _b, _c = _a.selectors, SelectorsConstructor = _c === void 0 ? Selectors : _c, _d = _a.constants, constants = _d === void 0 ? {} : _d, _e = _a.utils, utils = _e === void 0 ? {} : _e, _f = _a.defaultItem, defaultItem = _f === void 0 ? {} : _f, _g = _a.defaultState, defaultState = _g === void 0 ? { items: {} } : _g, _h = _a.reducer, reducer = _h === void 0 ? function (state, action) { return state; } : _h, _j = _a.generateId, customGenerateIdFunc = _j === void 0 ? generateId : _j; | ||
var name = _a.name, _b = _a.actions, ActionsArg = _b === void 0 ? Actions : _b, _c = _a.selectors, SelectorsArg = _c === void 0 ? Selectors : _c, _d = _a.constants, constants = _d === void 0 ? {} : _d, _e = _a.utils, utils = _e === void 0 ? {} : _e, _f = _a.defaultItem, defaultItem = _f === void 0 ? {} : _f, _g = _a.defaultState, defaultState = _g === void 0 ? { items: {} } : _g, _h = _a.reducer, reducer = _h === void 0 ? function (state, action) { return state; } : _h, _j = _a.generateId, customGenerateIdFunc = _j === void 0 ? generateId : _j; | ||
this.name = name; | ||
@@ -204,9 +204,9 @@ var defaultConstants = constantsFactory(name); | ||
this.action = | ||
typeof ActionsConstructor === 'function' | ||
? new ActionsConstructor(this.name, this.constant, this.defaultItem, customGenerateIdFunc) | ||
: ActionsConstructor; | ||
typeof ActionsArg === 'function' | ||
? new ActionsArg(this.name, this.constant, this.defaultItem, customGenerateIdFunc) | ||
: ActionsArg; | ||
this.select = | ||
typeof SelectorsConstructor === 'function' | ||
? new SelectorsConstructor(this.name) | ||
: SelectorsConstructor; | ||
typeof SelectorsArg === 'function' | ||
? new SelectorsArg(this.name) | ||
: SelectorsArg; | ||
} | ||
@@ -213,0 +213,0 @@ StateBranch.prototype.reducer = function (state, _action) { |
{ | ||
"name": "redux-state-branch", | ||
"version": "0.0.39", | ||
"version": "0.0.40", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "A redux wrapper for sane people.", |
Sorry, the diff of this file is not supported yet
49811
881