state-decorator
Version:
React state management library
68 lines (67 loc) • 2.47 kB
TypeScript
/**
* Effect function that sets the first action argument to the specified prop.
* if dirtyProp is set
*/
export declare function setArgIn<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
s: S;
args: [S[K]];
}) => Partial<S>;
/**
* Effect function that sets <code>true</code> in the specified prop.
*/
export declare function setTrueIn<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
s: S;
}) => Partial<S>;
/**
* Effect function that sets <code>false</code> in the specified prop.
*/
export declare function setFalseIn<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
s: S;
}) => Partial<S>;
/**
* Effect function that sets toggles the boolean value of the specified prop.
*/
export declare function toggleProp<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
s: S;
}) => Partial<S>;
/**
* Effect function that sets the update the specifed prop as an array using first action argument as index
* and second as value to set.
*/
export declare function setArgsInMap<S, K extends keyof S, K2 extends keyof S, T>(propName: K, dirtyProp?: K2): (ctx: {
s: S;
args: [string, T];
}) => Partial<S>;
/**
* Effect function that sets the update the specifed prop as an array using first action argument as index
* and second as value to set.
*/
export declare function setArgsInArray<S, K extends keyof S, K2 extends keyof S, T>(propName: K, dirtyProp?: K2): (ctx: {
s: S;
args: [number, T];
}) => Partial<S>;
/**
* Effect function that sets the asynchronous action result to the specified prop.
*/
export declare function setResIn<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
s: S;
res: S[K];
}) => Partial<S>;
/**
* Effect function that sets the update the specifed prop as an array using first action argument as index
* and second as value to set.
*/
export declare function setResInArray<S, K extends keyof S, K2 extends keyof S, T>(propName: K, dirtyProp?: K2): (ctx: {
s: S;
args: [number];
res: T;
}) => Partial<S>;
/**
* Effect function that sets the update the specifed prop as an array using first action argument as index
* and second as value to set.
*/
export declare function setResInMap<S, K extends keyof S, K2 extends keyof S, T>(propName: K, dirtyProp?: K2): (ctx: {
s: S;
args: [string];
res: T;
}) => Partial<S>;