Skip to content
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

Update TypeScript to 5.4 #4255

Merged
merged 23 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
fail-fast: false
matrix:
node: ['20.x']
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3']
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3', '5.4']
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"release-it": "^14.12.5",
"serve": "^14.2.0",
"ts-node": "^10.9.2",
"typescript": "^5.2.2"
"typescript": "^5.4.2"
},
"resolutions": {
"@babel/core": "7.19.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"tslib": "^1.10.0",
"tsup": "^7.2.0",
"tsx": "^3.12.2",
"typescript": "^5.3.3",
"typescript": "^5.4.2",
"vite-tsconfig-paths": "^4.3.1",
"vitest": "^1.1.3",
"yargs": "^15.3.1"
Expand Down
6 changes: 4 additions & 2 deletions packages/toolkit/src/createAsyncThunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ export const createAsyncThunk = /* @__PURE__ */ (() => {
}
abortController.signal.addEventListener('abort', abortHandler)
})
dispatch(
;(dispatch as ThunkDispatch<unknown, unknown, UnknownAction>)(
aryaemami59 marked this conversation as resolved.
Show resolved Hide resolved
pending(
requestId,
arg,
Expand Down Expand Up @@ -679,7 +679,9 @@ export const createAsyncThunk = /* @__PURE__ */ (() => {
(finalAction as any).meta.condition

if (!skipDispatch) {
dispatch(finalAction as any)
;(dispatch as ThunkDispatch<unknown, unknown, UnknownAction>)(
finalAction as any,
)
}
return finalAction
})()
Expand Down
11 changes: 7 additions & 4 deletions packages/toolkit/src/tests/createReducer.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ describe('type tests', () => {

// @ts-expect-error
createReducer<string>(0 as number, (builder) => {
// @ts-expect-error
builder
.addCase('increment', incrementHandler)
.addCase('decrement', decrementHandler)
expectTypeOf(builder.addCase)
.parameter(1)
.not.toMatchTypeOf(incrementHandler)

expectTypeOf(builder.addCase)
.parameter(1)
.not.toMatchTypeOf(decrementHandler)
})
})

Expand Down
24 changes: 22 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7372,7 +7372,7 @@ __metadata:
tslib: "npm:^1.10.0"
tsup: "npm:^7.2.0"
tsx: "npm:^3.12.2"
typescript: "npm:^5.3.3"
typescript: "npm:^5.4.2"
vite-tsconfig-paths: "npm:^4.3.1"
vitest: "npm:^1.1.3"
yargs: "npm:^15.3.1"
Expand Down Expand Up @@ -25525,7 +25525,7 @@ __metadata:
release-it: "npm:^14.12.5"
serve: "npm:^14.2.0"
ts-node: "npm:^10.9.2"
typescript: "npm:^5.2.2"
typescript: "npm:^5.4.2"
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -28061,6 +28061,16 @@ __metadata:
languageName: node
linkType: hard

"typescript@npm:^5.4.2":
version: 5.4.2
resolution: "typescript@npm:5.4.2"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10/f8cfdc630ab1672f004e9561eb2916935b2d267792d07ce93e97fc601c7a65191af32033d5e9c0169b7dc37da7db9bf320f7432bc84527cb7697effaa4e4559d
languageName: node
linkType: hard

"typescript@npm:~4.2.4":
version: 4.2.4
resolution: "typescript@npm:4.2.4"
Expand Down Expand Up @@ -28111,6 +28121,16 @@ __metadata:
languageName: node
linkType: hard

"typescript@patch:typescript@npm%3A^5.4.2#optional!builtin<compat/typescript>":
version: 5.4.2
resolution: "typescript@patch:typescript@npm%3A5.4.2#optional!builtin<compat/typescript>::version=5.4.2&hash=d69c25"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10/ef4fc2994cc0219dc9ada94c92106ba8d44cbfd7a0328ed6f8d730311caf66e114cdfa07fbc6f369bfc0fc182d9493851b3bf1644c06fc5818690b19ee960d72
languageName: node
linkType: hard

"typescript@patch:typescript@npm%3A~4.2.4#optional!builtin<compat/typescript>":
version: 4.2.4
resolution: "typescript@patch:typescript@npm%3A4.2.4#optional!builtin<compat/typescript>::version=4.2.4&hash=334f98"
Expand Down