Unverified Commit 410250bf authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

Update React types (#75245)

Allows us to remove some `any` casts and `@ts-expect-error`.
parent 394ee67a
...@@ -118,8 +118,8 @@ ...@@ -118,8 +118,8 @@
"@types/jest": "29.5.5", "@types/jest": "29.5.5",
"@types/node": "20.17.6", "@types/node": "20.17.6",
"@types/node-fetch": "2.6.1", "@types/node-fetch": "2.6.1",
"@types/react": "19.0.0", "@types/react": "19.0.8",
"@types/react-dom": "19.0.0", "@types/react-dom": "19.0.3",
"@types/relay-runtime": "14.1.13", "@types/relay-runtime": "14.1.13",
"@types/string-hash": "1.1.1", "@types/string-hash": "1.1.1",
"@types/trusted-types": "2.0.3", "@types/trusted-types": "2.0.3",
...@@ -271,8 +271,8 @@ ...@@ -271,8 +271,8 @@
"@babel/parser": "7.22.5", "@babel/parser": "7.22.5",
"@babel/types": "7.22.5", "@babel/types": "7.22.5",
"@babel/traverse": "7.22.5", "@babel/traverse": "7.22.5",
"@types/react": "19.0.0", "@types/react": "19.0.8",
"@types/react-dom": "19.0.0", "@types/react-dom": "19.0.3",
"jest-snapshot": "30.0.0-alpha.6", "jest-snapshot": "30.0.0-alpha.6",
"react": "19.1.0-canary-ae9017ce-20250122", "react": "19.1.0-canary-ae9017ce-20250122",
"react-dom": "19.1.0-canary-ae9017ce-20250122", "react-dom": "19.1.0-canary-ae9017ce-20250122",
......
...@@ -206,8 +206,8 @@ ...@@ -206,8 +206,8 @@
"@types/path-to-regexp": "1.7.0", "@types/path-to-regexp": "1.7.0",
"@types/picomatch": "2.3.3", "@types/picomatch": "2.3.3",
"@types/platform": "1.3.4", "@types/platform": "1.3.4",
"@types/react": "19.0.0", "@types/react": "19.0.8",
"@types/react-dom": "19.0.0", "@types/react-dom": "19.0.8",
"@types/react-is": "18.2.4", "@types/react-is": "18.2.4",
"@types/semver": "7.3.1", "@types/semver": "7.3.1",
"@types/send": "0.14.4", "@types/send": "0.14.4",
......
...@@ -234,10 +234,6 @@ function Head({ ...@@ -234,10 +234,6 @@ function Head({
// We use `useDeferredValue` to handle switching between the prefetched and // We use `useDeferredValue` to handle switching between the prefetched and
// final values. The second argument is returned on initial render, then it // final values. The second argument is returned on initial render, then it
// re-renders with the first argument. // re-renders with the first argument.
//
// @ts-expect-error The second argument to `useDeferredValue` is only
// available in the experimental builds. When its disabled, it will always
// return `head`.
return useDeferredValue(head, resolvedPrefetchRsc) return useDeferredValue(head, resolvedPrefetchRsc)
} }
......
...@@ -6,12 +6,12 @@ const REACT_ERROR_STACK_BOTTOM_FRAME_REGEX = new RegExp( ...@@ -6,12 +6,12 @@ const REACT_ERROR_STACK_BOTTOM_FRAME_REGEX = new RegExp(
`(at ${REACT_ERROR_STACK_BOTTOM_FRAME} )|(${REACT_ERROR_STACK_BOTTOM_FRAME}\\@)` `(at ${REACT_ERROR_STACK_BOTTOM_FRAME} )|(${REACT_ERROR_STACK_BOTTOM_FRAME}\\@)`
) )
const captureOwnerStack = (React as any).captureOwnerStack const captureOwnerStack = React.captureOwnerStack
? (React as any).captureOwnerStack ? React.captureOwnerStack
: () => '' : () => ''
export function getReactStitchedError<T = unknown>(err: T): Error | T { export function getReactStitchedError<T = unknown>(err: T): Error | T {
if (typeof (React as any).captureOwnerStack !== 'function') { if (typeof React.captureOwnerStack !== 'function') {
return err return err
} }
const isErrorInstance = isError(err) const isErrorInstance = isError(err)
......
...@@ -352,10 +352,6 @@ function InnerLayoutRouter({ ...@@ -352,10 +352,6 @@ function InnerLayoutRouter({
// We use `useDeferredValue` to handle switching between the prefetched and // We use `useDeferredValue` to handle switching between the prefetched and
// final values. The second argument is returned on initial render, then it // final values. The second argument is returned on initial render, then it
// re-renders with the first argument. // re-renders with the first argument.
//
// @ts-expect-error The second argument to `useDeferredValue` is only
// available in the experimental builds. When its disabled, it will always
// return `rsc`.
const rsc: any = useDeferredValue(cacheNode.rsc, resolvedPrefetchRsc) const rsc: any = useDeferredValue(cacheNode.rsc, resolvedPrefetchRsc)
// `rsc` is either a React node or a promise for a React node, except we // `rsc` is either a React node or a promise for a React node, except we
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment