Skip to content

Commit 410250b

Browse files
authored
Update React types (#75245)
Allows us to remove some `any` casts and `@ts-expect-error`.
1 parent 394ee67 commit 410250b

File tree

6 files changed

+78
-84
lines changed

6 files changed

+78
-84
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@
118118
"@types/jest": "29.5.5",
119119
"@types/node": "20.17.6",
120120
"@types/node-fetch": "2.6.1",
121-
"@types/react": "19.0.0",
122-
"@types/react-dom": "19.0.0",
121+
"@types/react": "19.0.8",
122+
"@types/react-dom": "19.0.3",
123123
"@types/relay-runtime": "14.1.13",
124124
"@types/string-hash": "1.1.1",
125125
"@types/trusted-types": "2.0.3",
@@ -271,8 +271,8 @@
271271
"@babel/parser": "7.22.5",
272272
"@babel/types": "7.22.5",
273273
"@babel/traverse": "7.22.5",
274-
"@types/react": "19.0.0",
275-
"@types/react-dom": "19.0.0",
274+
"@types/react": "19.0.8",
275+
"@types/react-dom": "19.0.3",
276276
"jest-snapshot": "30.0.0-alpha.6",
277277
"react": "19.1.0-canary-ae9017ce-20250122",
278278
"react-dom": "19.1.0-canary-ae9017ce-20250122",

packages/next/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@
206206
"@types/path-to-regexp": "1.7.0",
207207
"@types/picomatch": "2.3.3",
208208
"@types/platform": "1.3.4",
209-
"@types/react": "19.0.0",
210-
"@types/react-dom": "19.0.0",
209+
"@types/react": "19.0.8",
210+
"@types/react-dom": "19.0.8",
211211
"@types/react-is": "18.2.4",
212212
"@types/semver": "7.3.1",
213213
"@types/send": "0.14.4",

packages/next/src/client/components/app-router.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,6 @@ function Head({
234234
// We use `useDeferredValue` to handle switching between the prefetched and
235235
// final values. The second argument is returned on initial render, then it
236236
// re-renders with the first argument.
237-
//
238-
// @ts-expect-error The second argument to `useDeferredValue` is only
239-
// available in the experimental builds. When its disabled, it will always
240-
// return `head`.
241237
return useDeferredValue(head, resolvedPrefetchRsc)
242238
}
243239

packages/next/src/client/components/errors/stitched-error.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ const REACT_ERROR_STACK_BOTTOM_FRAME_REGEX = new RegExp(
66
`(at ${REACT_ERROR_STACK_BOTTOM_FRAME} )|(${REACT_ERROR_STACK_BOTTOM_FRAME}\\@)`
77
)
88

9-
const captureOwnerStack = (React as any).captureOwnerStack
10-
? (React as any).captureOwnerStack
9+
const captureOwnerStack = React.captureOwnerStack
10+
? React.captureOwnerStack
1111
: () => ''
1212

1313
export function getReactStitchedError<T = unknown>(err: T): Error | T {
14-
if (typeof (React as any).captureOwnerStack !== 'function') {
14+
if (typeof React.captureOwnerStack !== 'function') {
1515
return err
1616
}
1717
const isErrorInstance = isError(err)

packages/next/src/client/components/layout-router.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,6 @@ function InnerLayoutRouter({
352352
// We use `useDeferredValue` to handle switching between the prefetched and
353353
// final values. The second argument is returned on initial render, then it
354354
// re-renders with the first argument.
355-
//
356-
// @ts-expect-error The second argument to `useDeferredValue` is only
357-
// available in the experimental builds. When its disabled, it will always
358-
// return `rsc`.
359355
const rsc: any = useDeferredValue(cacheNode.rsc, resolvedPrefetchRsc)
360356

361357
// `rsc` is either a React node or a promise for a React node, except we

0 commit comments

Comments
 (0)