Skip to content

Commit d36917c

Browse files
authored
Bump React types to 19 rc (vercel#66186)
1 parent 6ea265f commit d36917c

File tree

50 files changed

+97
-89
lines changed

Some content is hidden

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

50 files changed

+97
-89
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@
107107
"@types/jest": "29.5.5",
108108
"@types/node": "20.12.3",
109109
"@types/node-fetch": "2.6.1",
110-
"@types/react": "18.3.3",
111-
"@types/react-dom": "18.3.0",
110+
"@types/react": "npm:types-react@19.0.0-rc.0",
111+
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.0",
112112
"@types/relay-runtime": "14.1.13",
113113
"@types/string-hash": "1.1.1",
114114
"@types/trusted-types": "2.0.3",
@@ -251,8 +251,8 @@
251251
"@babel/parser": "7.22.5",
252252
"@babel/types": "7.22.5",
253253
"@babel/traverse": "7.22.5",
254-
"@types/react": "18.3.3",
255-
"@types/react-dom": "18.3.0",
254+
"@types/react": "npm:types-react@19.0.0-rc.0",
255+
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.0",
256256
"react": "19.0.0-rc-f994737d14-20240522",
257257
"react-dom": "19.0.0-rc-f994737d14-20240522",
258258
"react-is": "19.0.0-rc-f994737d14-20240522",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function AppRouterAnnouncer({ tree }: { tree: FlightRouterState }) {
4242
}, [])
4343

4444
const [routeAnnouncement, setRouteAnnouncement] = useState('')
45-
const previousTitle = useRef<string | undefined>()
45+
const previousTitle = useRef<string | undefined>(undefined)
4646

4747
useEffect(() => {
4848
let currentTitle = ''

packages/next/src/client/components/error-boundary.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import React from 'react'
3+
import React, { type JSX } from 'react'
44
import { usePathname } from './navigation'
55
import { isNextRouterError } from './is-next-router-error'
66
import { staticGenerationAsyncStorage } from './static-generation-async-storage.external'

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import React, {
1818
startTransition,
1919
Suspense,
2020
useDeferredValue,
21+
type JSX,
2122
} from 'react'
2223
import ReactDOM from 'react-dom'
2324
import {

packages/next/src/client/components/react-dev-overlay/internal/helpers/use-websocket.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getSocketUrl } from './get-socket-url'
44
import type { TurbopackMsgToBrowser } from '../../../../../server/dev/hot-reloader-types'
55

66
export function useWebsocket(assetPrefix: string) {
7-
const webSocketRef = useRef<WebSocket>()
7+
const webSocketRef = useRef<WebSocket>(undefined)
88

99
useEffect(() => {
1010
if (webSocketRef.current) {

packages/next/src/client/components/react-dev-overlay/shared.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export const INITIAL_OVERLAY_STATE: OverlayState = {
9494
}
9595

9696
export function useErrorOverlayReducer() {
97-
return useReducer<React.Reducer<OverlayState, BusEvent>>((_state, action) => {
97+
return useReducer((_state: OverlayState, action: BusEvent): OverlayState => {
9898
switch (action.type) {
9999
case ACTION_BUILD_OK: {
100100
return { ..._state, buildError: null }

packages/next/src/client/components/render-from-template-context.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import React, { useContext } from 'react'
3+
import React, { useContext, type JSX } from 'react'
44
import { TemplateContext } from '../../shared/lib/app-router-context.shared-runtime'
55

66
export default function RenderFromTemplateContext(): JSX.Element {

packages/next/src/client/components/use-reducer-with-devtools.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ function useReducerWithReduxDevtoolsImpl(
103103
throw new Error('Invariant: Missing ActionQueueContext')
104104
}
105105

106-
const devtoolsConnectionRef = useRef<ReduxDevToolsInstance>()
107-
const enabledRef = useRef<boolean>()
106+
const devtoolsConnectionRef = useRef<ReduxDevToolsInstance>(undefined)
107+
const enabledRef = useRef<boolean>(undefined)
108108

109109
useEffect(() => {
110110
if (devtoolsConnectionRef.current || enabledRef.current === false) {

packages/next/src/client/head-manager.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { setAttributesFromProps } from './set-attributes-from-props'
22

3+
import type { JSX } from 'react'
4+
35
function reactElementToDOM({ type, props }: JSX.Element): HTMLElement {
46
const el: HTMLElement = document.createElement(type)
57
setAttributesFromProps(el, props)

packages/next/src/client/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type {
88
PrivateRouteInfo,
99
} from '../shared/lib/router/router'
1010

11-
import React from 'react'
11+
import React, { type JSX } from 'react'
1212
import ReactDOM from 'react-dom/client'
1313
import { HeadManagerContext } from '../shared/lib/head-manager-context.shared-runtime'
1414
import mitt from '../shared/lib/mitt'

0 commit comments

Comments
 (0)