Skip to content

Commit f09524c

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 d398d8f commit f09524c

108 files changed

Lines changed: 886 additions & 417 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/tests.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -138,47 +138,47 @@ jobs:
138138
include:
139139
# React 19 × all TS versions
140140
- node: '24.x'
141-
ts: '5.4'
141+
ts: '5.5'
142142
react:
143143
{
144144
version: '^19',
145145
types: '^19',
146146
react-dom: { version: '^19', types: '^19' },
147147
}
148148
- node: '24.x'
149-
ts: '5.5'
149+
ts: '5.6'
150150
react:
151151
{
152152
version: '^19',
153153
types: '^19',
154154
react-dom: { version: '^19', types: '^19' },
155155
}
156156
- node: '24.x'
157-
ts: '5.6'
157+
ts: '5.7'
158158
react:
159159
{
160160
version: '^19',
161161
types: '^19',
162162
react-dom: { version: '^19', types: '^19' },
163163
}
164164
- node: '24.x'
165-
ts: '5.7'
165+
ts: '5.8'
166166
react:
167167
{
168168
version: '^19',
169169
types: '^19',
170170
react-dom: { version: '^19', types: '^19' },
171171
}
172172
- node: '24.x'
173-
ts: '5.8'
173+
ts: '5.9'
174174
react:
175175
{
176176
version: '^19',
177177
types: '^19',
178178
react-dom: { version: '^19', types: '^19' },
179179
}
180180
- node: '24.x'
181-
ts: '5.9'
181+
ts: '6.0'
182182
react:
183183
{
184184
version: '^19',
@@ -193,17 +193,17 @@ jobs:
193193
types: '^19',
194194
react-dom: { version: '^19', types: '^19' },
195195
}
196-
# React 18 × boundary TS versions only (5.4, 5.9, next)
196+
# React 18 × boundary TS versions only (5.5, 6.0, next)
197197
- node: '24.x'
198-
ts: '5.4'
198+
ts: '5.5'
199199
react:
200200
{
201201
version: '^18',
202202
types: '^18',
203203
react-dom: { version: '^18', types: '^18' },
204204
}
205205
- node: '24.x'
206-
ts: '5.9'
206+
ts: '6.0'
207207
react:
208208
{
209209
version: '^18',
@@ -386,9 +386,6 @@ jobs:
386386
# Sparse matrix: All TS versions with bundler, boundary TS versions with nodenext
387387
include:
388388
# bundler × all TS versions
389-
- node: '24.x'
390-
ts: '5.4'
391-
example: { name: 'bundler', moduleResolution: 'Bundler' }
392389
- node: '24.x'
393390
ts: '5.5'
394391
example: { name: 'bundler', moduleResolution: 'Bundler' }
@@ -404,25 +401,28 @@ jobs:
404401
- node: '24.x'
405402
ts: '5.9'
406403
example: { name: 'bundler', moduleResolution: 'Bundler' }
404+
- node: '24.x'
405+
ts: '6.0'
406+
example: { name: 'bundler', moduleResolution: 'Bundler' }
407407
- node: '24.x'
408408
ts: 'next'
409409
example: { name: 'bundler', moduleResolution: 'Bundler' }
410-
# nodenext-cjs × boundary TS versions only (5.4, 5.9, next)
410+
# nodenext-cjs × boundary TS versions only (5.5, 6.0, next)
411411
- node: '24.x'
412-
ts: '5.4'
412+
ts: '5.5'
413413
example: { name: 'nodenext-cjs', moduleResolution: 'NodeNext' }
414414
- node: '24.x'
415-
ts: '5.9'
415+
ts: '6.0'
416416
example: { name: 'nodenext-cjs', moduleResolution: 'NodeNext' }
417417
- node: '24.x'
418418
ts: 'next'
419419
example: { name: 'nodenext-cjs', moduleResolution: 'NodeNext' }
420-
# nodenext-esm × boundary TS versions only (5.4, 5.9, next)
420+
# nodenext-esm × boundary TS versions only (5.5, 6.0, next)
421421
- node: '24.x'
422-
ts: '5.4'
422+
ts: '5.5'
423423
example: { name: 'nodenext-esm', moduleResolution: 'NodeNext' }
424424
- node: '24.x'
425-
ts: '5.9'
425+
ts: '6.0'
426426
example: { name: 'nodenext-esm', moduleResolution: 'NodeNext' }
427427
- node: '24.x'
428428
ts: 'next'

docs/api/matching-utilities.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ function someFunction(action: PayloadAction<Data>) {
258258
```ts title="Using isAnyOf as a type guard"
259259
import { isAnyOf } from '@reduxjs/toolkit'
260260
import type { PayloadAction } from '@reduxjs/toolkit'
261-
import { Data, isSpecial, isInteresting } from '@virtual/matchers' // this is a fake pkg that provides the types shown above
261+
import type { Data } from '@virtual/matchers' // this is a fake pkg that provides the types shown above
262+
import { isSpecial, isInteresting } from '@virtual/matchers' // this is a fake pkg that provides the types shown above
262263
263264
const isSpecialOrInteresting = isAnyOf(isSpecial, isInteresting)
264265

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from 'react'
1+
import type { FC, PropsWithChildren } from 'react'
22

3-
export const DetailedExplanation = ({
3+
export const DetailedExplanation: FC<PropsWithChildren<{ title?: string }>> = ({
44
children,
55
title = 'Detailed Explanation',
66
}) => {

docs/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
"name": "docs",
33
"devDependencies": {
44
"@manaflair/redux-batch": "^1.0.0",
5+
"@reduxjs/toolkit": "workspace:^",
56
"@types/nanoid": "^2.1.0",
7+
"@types/node": "^25.5.0",
68
"@types/react": "^19.0.1",
79
"async-mutex": "^0.3.2",
810
"axios": "^0.20.0",
@@ -12,6 +14,7 @@
1214
"nanoid": "^3.1.23",
1315
"next-redux-wrapper": "^7.0.5",
1416
"redux-persist": "^6.0.0",
15-
"rxjs": "^6.6.2"
17+
"rxjs": "^6.6.2",
18+
"typescript": "^6.0.3"
1619
}
1720
}

docs/rtk-query/usage/automated-refetching.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ e.g. `['Post'] / [{ type: 'Post' }]`
541541
542542
Will `invalidate` any `provided` tag with the matching type, including general and specific tags.
543543
544-
Example:
544+
Example:
545545
If a general tag of `Post` was invalidated, endpoints whose data `provided` the following tags would all have their data invalidated:
546546
547547
- `['Post']`
@@ -778,11 +778,11 @@ The example below demonstrates an example with the following behavior:
778778

779779
- Provides an `UNAUTHORIZED` cache tag if a query fails with an error code of `401 UNAUTHORIZED`
780780
- Provides an `UNKNOWN_ERROR` cache tag if a query fails with a different error
781-
- Enables a 'login' mutation, which when _successful_, will `invalidate` the data with the `UNAUTHORIZED` tag.
781+
- Enables a 'login' mutation, which when _successful_, will `invalidate` the data with the `UNAUTHORIZED` tag.
782782
This will trigger the `postById` endpoint to re-fire if:
783783
1. The last call for `postById` had encountered an unauthorized error, and
784784
2. A component is still subscribed to the cached data
785-
- Enables a 'refetchErroredQueries' mutation which when _called_, will `invalidate` the data with the `UNKNOWN_ERROR` tag.
785+
- Enables a 'refetchErroredQueries' mutation which when _called_, will `invalidate` the data with the `UNKNOWN_ERROR` tag.
786786
This will trigger the `postById` endpoint to re-fire if:
787787
1. The last call for `postById` had encountered an unknown error, and
788788
2. A component is still subscribed to the cached data
@@ -797,7 +797,7 @@ export interface LoginResponse {}
797797

798798
// file: api.ts
799799
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'
800-
import { Post, LoginResponse } from './types'
800+
import type { LoginResponse, Post } from './types'
801801

802802
const api = createApi({
803803
baseQuery: fetchBaseQuery({ baseUrl: 'https://example.com' }),

docs/rtk-query/usage/customizing-create-api.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ If you want the hooks to use different versions of `useSelector`, `useDispatch`
2323

2424
```ts
2525
import * as React from 'react'
26+
import type { ReactReduxContextValue } from 'react-redux'
2627
import {
2728
createDispatchHook,
2829
createSelectorHook,
2930
createStoreHook,
30-
ReactReduxContextValue,
3131
} from 'react-redux'
3232
import {
3333
buildCreateApi,

docs/rtk-query/usage/customizing-queries.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ export const { useGetPostsQuery } = api
844844

845845
```ts title="GraphQL transformation example"
846846
// file: graphqlBaseQuery.ts noEmit
847-
import { BaseQueryFn } from '@reduxjs/toolkit/query'
847+
import type { BaseQueryFn } from '@reduxjs/toolkit/query'
848848
declare const graphqlBaseQuery: (args: { baseUrl: string }) => BaseQueryFn
849849
declare const gql: (literals: TemplateStringsArray) => void
850850
export { graphqlBaseQuery, gql }

docs/rtk-query/usage/migrating-to-rtk-query.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ Below we create a hook to manage sending our request at the appropriate time, as
197197

198198
```ts title="src/hooks.ts"
199199
// file: src/services/pokemonSlice.ts noEmit
200-
import { AsyncThunkAction } from '@reduxjs/toolkit'
201-
import { RootState } from '../store'
200+
import type { AsyncThunkAction } from '@reduxjs/toolkit'
201+
import type { RootState } from '../store'
202202
interface Pokemon {}
203203
export declare const fetchPokemonByName: (
204204
arg: string,
@@ -211,7 +211,7 @@ export const selectDataByName = (state: RootState, name: string) =>
211211

212212
// file: src/store.ts noEmit
213213
import { useDispatch } from 'react-redux'
214-
import { EnhancedStore } from '@reduxjs/toolkit'
214+
import type { EnhancedStore } from '@reduxjs/toolkit'
215215
interface Pokemon {}
216216
type RequestState = 'pending' | 'fulfilled' | 'rejected'
217217

docs/tsconfig.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"allowSyntheticDefaultImports": true,
44
"esModuleInterop": true,
5-
"moduleResolution": "node",
5+
"moduleResolution": "bundler",
66
"noUnusedLocals": false,
77
"noUnusedParameters": false,
88
"allowUnusedLabels": true,
@@ -14,7 +14,6 @@
1414
"target": "ES2020",
1515
"allowJs": true,
1616
"checkJs": true,
17-
"alwaysStrict": false,
1817
"baseUrl": "..",
1918
"jsx": "preserve",
2019
"traceResolution": false,
@@ -31,6 +30,8 @@
3130
"your-cool-library": ["docs/virtual/your-cool-library/index.ts"],
3231
"redux-logger": ["docs/virtual/redux-logger/index.ts"],
3332
"petstore-api.generated": ["docs/virtual/petstore-api.generated/index.ts"]
34-
}
33+
},
34+
"ignoreDeprecations": "6.0",
35+
"noUncheckedSideEffectImports": false
3536
}
3637
}

docs/usage/nextjs.mdx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export const useAppStore = useStore.withTypes<AppStore>()
149149

150150
To use this new `makeStore` function we need to create a new "client" component that will create the store and share it using the React-Redux `Provider` component.
151151

152-
```ts title="app/StoreProvider.tsx"
152+
```tsx title="app/StoreProvider.tsx"
153153
// file: lib/store.ts noEmit
154154
import { configureStore } from '@reduxjs/toolkit'
155155

@@ -172,7 +172,8 @@ export type AppDispatch = AppStore['dispatch']
172172
import { useRef } from 'react'
173173
import { Provider } from 'react-redux'
174174
// highlight-start
175-
import { makeStore, AppStore } from '../lib/store'
175+
import type { AppStore } from '../lib/store'
176+
import { makeStore } from '../lib/store'
176177
// highlight-end
177178

178179
export default function StoreProvider({
@@ -206,7 +207,7 @@ The next step is to **include the `StoreProvider` anywhere in the tree above whe
206207

207208
If you need to initialize the store with data from the parent component, then define that data as a prop on the client `StoreProvider` component and use a Redux action on the slice to set the data in the store as shown below.
208209

209-
```ts title="src/app/StoreProvider.tsx"
210+
```tsx title="src/app/StoreProvider.tsx"
210211
// file: lib/features/counter/counterSlice.ts noEmit
211212
import { createSlice } from '@reduxjs/toolkit'
212213
import type { PayloadAction } from '@reduxjs/toolkit'
@@ -250,7 +251,8 @@ export type AppDispatch = AppStore['dispatch']
250251
'use client'
251252
import { useRef } from 'react'
252253
import { Provider } from 'react-redux'
253-
import { makeStore, AppStore } from '../lib/store'
254+
import type { AppStore } from '../lib/store'
255+
import { makeStore } from '../lib/store'
254256
// highlight-start
255257
import { initializeCount } from '../lib/features/counter/counterSlice'
256258
// highlight-end
@@ -282,7 +284,7 @@ If you use Next.js's support for client side SPA-style navigation by using `next
282284

283285
Shown below is a `ProductName` example component that uses the Redux store to manage the mutable name of a product. The `ProductName` component is part of a product detail route. In order to ensure that we have the correct name in the store we need to set the value in the store any time the `ProductName` component is initially rendered, which happens on any route change to the product detail route.
284286

285-
```ts title="app/ProductName.tsx"
287+
```tsx title="app/ProductName.tsx"
286288
// file: lib/features/product/productSlice.ts noEmit
287289
import { createSlice } from '@reduxjs/toolkit'
288290
import type { PayloadAction } from '@reduxjs/toolkit'
@@ -344,10 +346,10 @@ export const useAppStore = useStore.withTypes<AppStore>()
344346
'use client'
345347
import { useRef } from 'react'
346348
import { useAppSelector, useAppDispatch, useAppStore } from '../lib/hooks'
349+
import type { Product } from '../lib/features/product/productSlice'
347350
import {
348351
initializeProduct,
349352
setProductName,
350-
Product,
351353
} from '../lib/features/product/productSlice'
352354

353355
export default function ProductName({ product }: { product: Product }) {

0 commit comments

Comments
 (0)