Skip to content

Commit b1b5bd5

Browse files
committed
chore: update TypeScript to v6.0
- Update TypeScript version to [v6.0](https://devblogs.microsoft.com/typescript/announcing-typescript-6-0). - Raise the minimum supported TypeScript version to [v5.5](https://devblogs.microsoft.com/typescript/announcing-typescript-5-5) (drop `5.0`-`5.4`).
1 parent 346a6f8 commit b1b5bd5

21 files changed

Lines changed: 1792 additions & 1727 deletions

.github/workflows/test.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
node: ['22.x']
15+
node: ['24.x']
1616

1717
steps:
1818
- name: Checkout code
@@ -54,8 +54,8 @@ jobs:
5454
strategy:
5555
fail-fast: false
5656
matrix:
57-
node: ['22.x']
58-
ts: ['5.0', '5.1', '5.2', '5.3', '5.4', '5.5', '5.6', '5.7', '5.8']
57+
node: ['24.x']
58+
ts: ['5.5', '5.6', '5.7', '5.8', '5.9', '6.0']
5959
react:
6060
[
6161
{
@@ -118,7 +118,7 @@ jobs:
118118
strategy:
119119
fail-fast: false
120120
matrix:
121-
node: ['22.x']
121+
node: ['24.x']
122122
steps:
123123
- name: Checkout repo
124124
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -151,7 +151,7 @@ jobs:
151151
strategy:
152152
fail-fast: false
153153
matrix:
154-
node: ['22.x']
154+
node: ['24.x']
155155
example:
156156
[
157157
'cra4',
@@ -178,7 +178,7 @@ jobs:
178178
- name: Clone RTK repo (pinned to known-good commit)
179179
run: |
180180
git init ./redux-toolkit
181-
git -C ./redux-toolkit fetch --depth 1 https://github.com/reduxjs/redux-toolkit.git 576a02f8056fbee2dcaddb4d2e4d2da3b7937c58
181+
git -C ./redux-toolkit fetch --depth 1 https://github.com/reduxjs/redux-toolkit.git 7c49510ff5dc6aad7cda24a59ec6c38a1af053be
182182
git -C ./redux-toolkit checkout FETCH_HEAD
183183
184184
- name: Cache example deps
@@ -236,7 +236,7 @@ jobs:
236236
strategy:
237237
fail-fast: false
238238
matrix:
239-
node: ['22.x']
239+
node: ['24.x']
240240
example: ['rr-rsc-context']
241241
defaults:
242242
run:
@@ -283,7 +283,7 @@ jobs:
283283
strategy:
284284
fail-fast: false
285285
matrix:
286-
node: ['22.x']
286+
node: ['24.x']
287287
react:
288288
[
289289
{

docs/tutorials/typescript.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ All generated actions should be defined using the `PayloadAction<T>` type from R
100100
You can safely import the `RootState` type from the store file here. It's a circular import, but the TypeScript compiler can correctly handle that for types. This may be needed for use cases like writing selector functions.
101101

102102
```ts title="features/counter/counterSlice.ts"
103-
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
103+
import type { PayloadAction } from '@reduxjs/toolkit'
104+
import { createSlice } from '@reduxjs/toolkit'
104105
import type { RootState } from '../../app/store'
105106

106107
// highlight-start

docs/using-react-redux/usage-with-typescript.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ const dispatch: AppDispatch = useDispatch()
149149
The package includes a helper type, `ConnectedProps`, that can extract the return types of `mapStateToProps` and `mapDispatchToProps` from the first function. This means that if you split the `connect` call into two steps, all of the "props from Redux" can be inferred automatically without having to write them by hand. While this approach may feel unusual if you've been using React-Redux for a while, it does simplify the type declarations considerably.
150150

151151
```ts
152-
import { connect, ConnectedProps } from 'react-redux'
152+
import type { ConnectedProps } from 'react-redux'
153+
import { connect } from 'react-redux'
153154

154155
interface RootState {
155156
isOn: boolean

examples/publish-ci/rr-rsc-context/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
"@types/node": "20.3.0",
1313
"@types/react": "18.2.12",
1414
"@types/react-dom": "18.2.5",
15-
"next": "13.4.5",
15+
"next": "^16.2.9",
1616
"react": "18.2.0",
1717
"react-dom": "18.2.0",
1818
"react-redux": "^8.0.7",
19-
"typescript": "5.1.3"
19+
"typescript": "^6.0.3"
2020
}
2121
}
Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,50 @@
11
{
22
"compilerOptions": {
3-
"target": "es5",
4-
"lib": ["dom", "dom.iterable", "esnext"],
3+
"allowArbitraryExtensions": true,
54
"allowJs": true,
6-
"skipLibCheck": true,
7-
"strict": true,
8-
"forceConsistentCasingInFileNames": true,
9-
"noEmit": true,
5+
"allowSyntheticDefaultImports": true,
6+
"checkJs": true,
7+
"declaration": true,
8+
"declarationMap": true,
109
"esModuleInterop": true,
11-
"module": "esnext",
12-
"moduleResolution": "node",
13-
"resolveJsonModule": true,
14-
"isolatedModules": true,
15-
"jsx": "preserve",
10+
"forceConsistentCasingInFileNames": true,
1611
"incremental": true,
12+
"isolatedModules": true,
13+
"jsx": "react-jsx",
14+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
15+
"module": "esnext",
16+
"moduleDetection": "force",
17+
"moduleResolution": "bundler",
18+
"noEmit": true,
19+
"noEmitOnError": true,
20+
"noErrorTruncation": true,
21+
"noImplicitOverride": true,
22+
"noImplicitReturns": true,
23+
"outDir": "./dist",
1724
"plugins": [
1825
{
1926
"name": "next"
2027
}
2128
],
22-
"paths": {
23-
"@/*": ["./*"]
24-
}
29+
"resolveJsonModule": true,
30+
"rootDir": "./",
31+
"skipLibCheck": true,
32+
"sourceMap": true,
33+
"strict": true,
34+
"target": "esnext",
35+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.tsbuildinfo",
36+
"types": ["node"],
37+
"useDefineForClassFields": true,
38+
"useUnknownInCatchVariables": true,
39+
"verbatimModuleSyntax": true
2540
},
26-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27-
"exclude": ["node_modules"]
41+
"exclude": ["node_modules", "dist"],
42+
"include": [
43+
"next-env.d.ts",
44+
"**/*.ts",
45+
"**/*.tsx",
46+
".next/types/**/*.ts",
47+
".next/dev/types/**/*.ts",
48+
"**/*.mts"
49+
]
2850
}

0 commit comments

Comments
 (0)