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 all 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 @@ -106,7 +106,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 @@ -40,7 +40,7 @@
"release-it": "^14.12.5",
"serve": "^14.2.0",
"ts-node": "^10.9.2",
"typescript": "^5.2.2"
"typescript": "^5.4.3"
},
"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.5",
"vite-tsconfig-paths": "^4.3.1",
"vitest": "^1.1.3",
"yargs": "^15.3.1"
Expand Down
6 changes: 3 additions & 3 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 @@ -240,7 +240,7 @@ export type AsyncThunkAction<
ThunkArg,
ThunkApiConfig extends AsyncThunkConfig,
> = (
dispatch: GetDispatch<ThunkApiConfig>,
dispatch: NonNullable<GetDispatch<ThunkApiConfig>>,
getState: () => GetState<ThunkApiConfig>,
extra: GetExtra<ThunkApiConfig>,
) => SafePromise<
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
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
44 changes: 42 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7371,7 +7371,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.5"
vite-tsconfig-paths: "npm:^4.3.1"
vitest: "npm:^1.1.3"
yargs: "npm:^15.3.1"
Expand Down Expand Up @@ -25487,7 +25487,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.3"
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -28023,6 +28023,26 @@ __metadata:
languageName: node
linkType: hard

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

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

"typescript@npm:~4.2.4":
version: 4.2.4
resolution: "typescript@npm:4.2.4"
Expand Down Expand Up @@ -28073,6 +28093,26 @@ __metadata:
languageName: node
linkType: hard

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

"typescript@patch:typescript@npm%3A^5.4.5#optional!builtin<compat/typescript>":
version: 5.4.5
resolution: "typescript@patch:typescript@npm%3A5.4.5#optional!builtin<compat/typescript>::version=5.4.5&hash=d69c25"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10/584be8bac7112ad49a9eb9992f71d542b1ff2fafb5bb315e1c196145e8feab589f1d7223cfb2d5df6770789582e6918f8287d1f2f89911b38eb80e29c560ad00
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