-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Hi! I want to use createAsyncThunk in my project, but there is some problems:
- Every time I want to use createAsyncThunk, I must pass types explicitly. Otherwise, I don't get types of state, extra, etc.
- If I pass my types, I lose type inferring of payloadCreator result. I need pass it explicitly too. Also, type of thunk argument moved to generic.
There are some redux libraries there is possible to redefine global interfaces. For example, react-redux do like that:
// This interface can be augmented by users to add default types for the root state when
export interface DefaultRootState {}This way is more convinient and can resolve these problems. I don't see any problems with that solution. In redux project is only one state.
In redux-toolkit I didn't find the same approach. ThunkApi depends on declare type AsyncThunkConfig, which I cannot redefine.
jeron-diovis
Metadata
Metadata
Assignees
Labels
No labels