[CHANGE_THEME]: (state: stateProps, { payload }): stateProps => ({
...state,
...payload,
}),
interface StateProps {
a: number;
b: string;
c: boolean;
}
interface Action<P> {
payload: Partial<P>;
}
const f = <P>(state: P, { payload }: Action<P>): P => ({
...state,
...payload,
});
let nextState = f(
{ a: 0, b: '', c: true },
{ payload: { c: false } }
);
.tsx
.