redux-state-branch
Advanced tools
Comparing version 0.0.40 to 0.0.41
@@ -51,7 +51,7 @@ interface AnyAction<T = any> { | ||
/** Get all items */ | ||
all<StateT>(state: StateT): AnyItem[]; | ||
all<StateT>(state: StateT): ItemT[]; | ||
/** Get an item by id */ | ||
byId<StateT>(state: StateT, id?: string | null): AnyItem | undefined; | ||
byId<StateT>(state: StateT, id?: string | null): ItemT | undefined; | ||
/** Get an items that meet a filter condition */ | ||
where<StateT>(state: StateT, condition: (item: ItemT) => boolean): AnyItem[]; | ||
where<StateT>(state: StateT, condition: (item: ItemT) => boolean): ItemT[]; | ||
/** Get the top level meta content */ | ||
@@ -96,2 +96,6 @@ meta<StateT>(state: StateT): State<any>; | ||
}; | ||
declare type ActionClassReturn<ItemT> = { | ||
type: string; | ||
items: PartialWithId<ItemT>[]; | ||
}; | ||
export declare class Actions<ItemT extends AnyItem, BranchStateT extends State<ItemT> = State<ItemT>> { | ||
@@ -105,30 +109,15 @@ protected branchName: string; | ||
/** Create an item */ | ||
create(items?: ItemsT<ItemT> | undefined, typeSuffix?: string | undefined): { | ||
type: string; | ||
items: PartialWithId<AnyItem>[]; | ||
}; | ||
create(items?: ItemsT<ItemT> | undefined, typeSuffix?: string | undefined): ActionClassReturn<ItemT>; | ||
/** Update an item */ | ||
update(items: ItemsT<ItemT>, typeSuffix?: string | undefined): { | ||
type: string; | ||
items: PartialWithId<AnyItem>[]; | ||
}; | ||
update(items: ItemsT<ItemT>, typeSuffix?: string | undefined): ActionClassReturn<ItemT>; | ||
/** Remove an item */ | ||
remove(items: string | ItemsT<ItemT> | string[], typeSuffix?: string | undefined): { | ||
type: string; | ||
items: PartialWithId<AnyItem>[]; | ||
}; | ||
remove(items: string | ItemsT<ItemT> | string[], typeSuffix?: string | undefined): ActionClassReturn<ItemT>; | ||
/** DEPRECATED, Use remove instead */ | ||
delete(items: string | ItemsT<ItemT> | string[], typeSuffix?: string | undefined): { | ||
type: string; | ||
items: PartialWithId<AnyItem>[]; | ||
}; | ||
delete(items: string | ItemsT<ItemT> | string[], typeSuffix?: string | undefined): ActionClassReturn<ItemT>; | ||
/** Replace an item */ | ||
replace(items: ItemsT<ItemT>, typeSuffix?: string | undefined): { | ||
type: string; | ||
items: PartialWithId<AnyItem>[]; | ||
}; | ||
replace(items: ItemsT<ItemT>, typeSuffix?: string | undefined): ActionClassReturn<ItemT>; | ||
/** Set meta content */ | ||
setMeta(meta: Partial<BranchStateT>, typeSuffix?: string | undefined): { | ||
type: string; | ||
meta: Partial<State<any>>; | ||
meta: Partial<BranchStateT>; | ||
}; | ||
@@ -135,0 +124,0 @@ /** Reset branch to initial state */ |
@@ -84,2 +84,3 @@ "use strict"; | ||
Selectors.prototype.meta = function (state) { | ||
// bug: cant cast this output as BranchStateT | ||
return this.methods.meta(state); | ||
@@ -86,0 +87,0 @@ }; |
{ | ||
"name": "redux-state-branch", | ||
"version": "0.0.40", | ||
"version": "0.0.41", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "A redux wrapper for sane people.", |
Sorry, the diff of this file is not supported yet
49748
871