Description
On typings.d.ts
file of @redux/toolkit
, a generic Action
of type CaseReducerWithPrepare
extends type PayloadAction
with default generics and constrains its method prepare
to return void
. However, a method prepare
of a payload action seems able to return any
. Does this type declaration fit the entity of the API?
PayloadAction:
export declare type PayloadAction<P = void, T extends string = string, M = never, E = never> = {
payload: P;
type: T;
} & ([M] extends [never] ? {} : {
meta: M;
}) & ([E] extends [never] ? {} : {
error: E;
});
CaseReducerWithPrepare:
export declare type CaseReducerWithPrepare<State, Action extends PayloadAction> = {
reducer: CaseReducer<State, Action>;
prepare: PrepareAction<Action['payload']>;
};
It looks like <any>
is required after Action extends PayloadAction
.
Metadata
Metadata
Assignees
Labels
No labels