Skip to content

Update TypeScript to 5.4 #4255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
May 9, 2024
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4749ea9
Bump TypeScript to 5.4
aryaemami59 Mar 6, 2024
6f3900d
Add TypeScript 5.4 to TS versions to test against during CI
aryaemami59 Mar 6, 2024
ae4fc54
Fix TS 5.4 issue related to `dispatch`
aryaemami59 Mar 6, 2024
b5dd9ef
Fix TS 5.4 issue in type tests related to `builder.addCase`
aryaemami59 Mar 6, 2024
8edbe4f
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 Mar 8, 2024
7251a67
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 Mar 11, 2024
7f1ef6b
require dispatch type to extend thunkdispatch
EskiMojo14 Mar 13, 2024
17bf9ed
Fix `dispatch` type in `AsyncThunkAction` to be `NonNullable`
aryaemami59 Mar 13, 2024
41ecb92
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 Mar 21, 2024
a376837
Bump TypeScript to 5.4.3
aryaemami59 Mar 21, 2024
653ecad
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 Apr 2, 2024
e2b7c9c
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 Apr 5, 2024
2a9461e
Bump TypeScript version to 5.4.4
aryaemami59 Apr 5, 2024
edbddd1
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 Apr 12, 2024
d45f4e7
Bump TypeScript version to 5.4.5
aryaemami59 Apr 12, 2024
8a411d4
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 Apr 16, 2024
6e45a36
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 Apr 17, 2024
0c127e6
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 May 1, 2024
d2a5dee
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 May 1, 2024
9fa6c1e
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 May 2, 2024
c26e056
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 May 6, 2024
cd7b335
Merge branch 'update-ts-to-5.4' of https://github.com/aryaemami59/red…
aryaemami59 May 7, 2024
6cfeb58
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 May 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
require dispatch type to extend thunkdispatch
  • Loading branch information
EskiMojo14 committed Mar 13, 2024
commit 7f1ef6bc9d1cbb1a0befa264a3add8cee02ecbdb
10 changes: 4 additions & 6 deletions packages/toolkit/src/createAsyncThunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const miniSerializeError = (value: any): SerializedError => {

export type AsyncThunkConfig = {
state?: unknown
dispatch?: Dispatch
dispatch?: ThunkDispatch<unknown, unknown, UnknownAction>
extra?: unknown
rejectValue?: unknown
serializedErrorType?: unknown
Expand Down Expand Up @@ -577,7 +577,7 @@ export const createAsyncThunk = /* @__PURE__ */ (() => {

function actionCreator(
arg: ThunkArg,
): AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> {
): AsyncThunkAction<Returned, ThunkArg, Required<ThunkApiConfig>> {
return (dispatch, getState, extra) => {
const requestId = options?.idGenerator
? options.idGenerator(arg)
Expand Down Expand Up @@ -617,7 +617,7 @@ export const createAsyncThunk = /* @__PURE__ */ (() => {
}
abortController.signal.addEventListener('abort', abortHandler)
})
;(dispatch as ThunkDispatch<unknown, unknown, UnknownAction>)(
dispatch(
pending(
requestId,
arg,
Expand Down Expand Up @@ -679,9 +679,7 @@ export const createAsyncThunk = /* @__PURE__ */ (() => {
(finalAction as any).meta.condition

if (!skipDispatch) {
;(dispatch as ThunkDispatch<unknown, unknown, UnknownAction>)(
finalAction as any,
)
dispatch(finalAction as any)
}
return finalAction
})()
Expand Down