Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 20x 20x 20x | export interface Action<T = unknown> {
type: string;
payload?: T;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
}
export interface ActionCreator<T = unknown> {
(payload?: T): Action<T>;
type: string;
}
export function makeActionCreator<T = unknown>(type: string): ActionCreator<T> {
const fn = (payload?: T): Action<T> => ({
type,
payload,
});
Object.defineProperty(fn, 'type', { value: type, writable: false });
return fn as ActionCreator<T>;
}
|