You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using @reduxjs/toolkit in my TypeScript project leads to these type errors related to AsyncThunkConfig.
Initially tsc was latest version, so I downgraded to 5.5.4 as it is defined in package.json and it does not help. How am I supposed to be using TypeScript with redux-toolkit?
node_modules/@reduxjs/toolkit/dist/index.d.ts:1445:148 - error TS2344: Type '{ [K in keyof (ThunkApiConfig & Omit<CurriedThunkApiConfig, keyof ThunkApiConfig>)]: (ThunkApiConfig & Omit<...>)[K]; }' does not satisfy the constraint 'AsyncThunkConfig'.
Types of property 'dispatch' are incompatible.
Type 'ThunkApiConfig["dispatch"] & CurriedThunkApiConfig["dispatch"]' is not assignable to type 'ThunkDispatch<unknown, unknown, UnknownAction>'.
1445 <Returned, ThunkArg, ThunkApiConfig extends AsyncThunkConfig>(typePrefix: string, payloadCreator: AsyncThunkPayloadCreator<Returned, ThunkArg, OverrideThunkApiConfigs<CurriedThunkApiConfig, ThunkApiConfig>>, options?: AsyncThunkOptions<ThunkArg, OverrideThunkApiConfigs<CurriedThunkApiConfig, ThunkApiConfig>>): AsyncThunk<Returned, ThunkArg, OverrideThunkApiConfigs<CurriedThunkApiConfig, ThunkApiConfig>>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@reduxjs/toolkit/dist/index.d.ts:1445:251 - error TS2344: Type '{ [K in keyof (ThunkApiConfig & Omit<CurriedThunkApiConfig, keyof ThunkApiConfig>)]: (ThunkApiConfig & Omit<...>)[K]; }' does not satisfy the constraint 'AsyncThunkConfig'.
1445 <Returned, ThunkArg, ThunkApiConfig extends AsyncThunkConfig>(typePrefix: string, payloadCreator: AsyncThunkPayloadCreator<Returned, ThunkArg, OverrideThunkApiConfigs<CurriedThunkApiConfig, ThunkApiConfig>>, options?: AsyncThunkOptions<ThunkArg, OverrideThunkApiConfigs<CurriedThunkApiConfig, ThunkApiConfig>>): AsyncThunk<Returned, ThunkArg, OverrideThunkApiConfigs<CurriedThunkApiConfig, ThunkApiConfig>>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@reduxjs/toolkit/dist/index.d.ts:1445:348 - error TS2344: Type '{ [K in keyof (ThunkApiConfig & Omit<CurriedThunkApiConfig, keyof ThunkApiConfig>)]: (ThunkApiConfig & Omit<...>)[K]; }' does not satisfy the constraint 'AsyncThunkConfig'.
1445 <Returned, ThunkArg, ThunkApiConfig extends AsyncThunkConfig>(typePrefix: string, payloadCreator: AsyncThunkPayloadCreator<Returned, ThunkArg, OverrideThunkApiConfigs<CurriedThunkApiConfig, ThunkApiConfig>>, options?: AsyncThunkOptions<ThunkArg, OverrideThunkApiConfigs<CurriedThunkApiConfig, ThunkApiConfig>>): AsyncThunk<Returned, ThunkArg, OverrideThunkApiConfigs<CurriedThunkApiConfig, ThunkApiConfig>>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@reduxjs/toolkit/dist/index.d.ts:1446:76 - error TS2344: Type '{ [K in keyof (ThunkApiConfig & Omit<CurriedThunkApiConfig, keyof ThunkApiConfig>)]: (ThunkApiConfig & Omit<...>)[K]; }' does not satisfy the constraint 'AsyncThunkConfig'.
Types of property 'dispatch' are incompatible.
Type 'ThunkApiConfig["dispatch"] & CurriedThunkApiConfig["dispatch"]' is not assignable to type 'ThunkDispatch<unknown, unknown, UnknownAction>'.
1446 withTypes<ThunkApiConfig extends AsyncThunkConfig>(): CreateAsyncThunk<OverrideThunkApiConfigs<CurriedThunkApiConfig, ThunkApiConfig>>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@reduxjs/toolkit/dist/index.d.ts:1677:101 - error TS2344: Type '{ [K in keyof (ThunkApiConfig & Omit<CurriedThunkApiConfig, keyof ThunkApiConfig>)]: (ThunkApiConfig & Omit<...>)[K]; }' does not satisfy the constraint 'PreventCircular<AsyncThunkConfig>'.
Types of property 'state' are incompatible.
Type 'ThunkApiConfig["state"] & CurriedThunkApiConfig["state"]' is not assignable to type 'never'.
1677 withTypes<ThunkApiConfig extends PreventCircular<AsyncThunkConfig>>(): AsyncThunkCreator<State, OverrideThunkApiConfigs<CurriedThunkApiConfig, ThunkApiConfig>>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@reduxjs/toolkit/dist/index.d.ts:2054:15 - error TS2420: Class 'TaskAbortError' incorrectly implements interface 'SerializedError'.
Types of property 'code' are incompatible.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
2054 declare class TaskAbortError implements SerializedError {
~~~~~~~~~~~~~~
Found 6 errors in the same file, starting at: node_modules/@reduxjs/toolkit/dist/index.d.ts:1445
The text was updated successfully, but these errors were encountered:
Possibly related to #3758
Using
@reduxjs/toolkit
in my TypeScript project leads to these type errors related to AsyncThunkConfig.Initially
tsc
was latest version, so I downgraded to5.5.4
as it is defined in package.json and it does not help. How am I supposed to be using TypeScript with redux-toolkit?The text was updated successfully, but these errors were encountered: