Skip to content

Commit

Permalink
Use stable @types/react
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Dec 5, 2024
1 parent 3c3fd73 commit ff95a32
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,7 @@ npm i next@latest react@rc react-dom@rc eslint-config-next@latest
- `useFormStatus` now includes additional keys like `data`, `method`, and `action`. If you are not using React 19, only the `pending` key is available. [Learn more](https://react.dev/reference/react-dom/hooks/useFormStatus).
- Read more in the [React 19 upgrade guide](https://react.dev/blog/2024/04/25/react-19-upgrade-guide).

### Updating types for react 19

If you are using TypeScript, you'll need to temporarily override the React types. Below is an example of the necessary type overrides needed in your `package.json`. See the [React 19 RC upgrade guide](https://react.dev/blog/2024/04/25/react-19-upgrade-guide#installing) for more information.

```json
{
"dependencies": {
"@types/react": "npm:types-react@rc",
"@types/react-dom": "npm:types-react-dom@rc"
},
"overrides": {
"@types/react": "npm:types-react@rc",
"@types/react-dom": "npm:types-react-dom@rc"
}
}
```
> **Good to know:** If you are using TypeScript, ensure you also upgrade `@types/react` and `@types/react-dom` to their latest versions.
## Async Request APIs (Breaking change)

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@
"@types/jest": "29.5.5",
"@types/node": "20.17.6",
"@types/node-fetch": "2.6.1",
"@types/react": "npm:types-react@19.0.0-rc.0",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.0",
"@types/react": "19.0.0",
"@types/react-dom": "19.0.0",
"@types/relay-runtime": "14.1.13",
"@types/string-hash": "1.1.1",
"@types/trusted-types": "2.0.3",
Expand Down Expand Up @@ -265,8 +265,8 @@
"@babel/parser": "7.22.5",
"@babel/types": "7.22.5",
"@babel/traverse": "7.22.5",
"@types/react": "npm:types-react@19.0.0-rc.0",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.0",
"@types/react": "19.0.0",
"@types/react-dom": "19.0.0",
"react": "19.0.0-rc-de68d2f4-20241204",
"react-dom": "19.0.0-rc-de68d2f4-20241204",
"react-is": "19.0.0-rc-de68d2f4-20241204",
Expand Down
4 changes: 2 additions & 2 deletions packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@
"@types/path-to-regexp": "1.7.0",
"@types/picomatch": "2.3.3",
"@types/platform": "1.3.4",
"@types/react": "18.2.74",
"@types/react-dom": "18.2.23",
"@types/react": "19.0.0",
"@types/react-dom": "19.0.0",
"@types/react-is": "18.2.4",
"@types/semver": "7.3.1",
"@types/send": "0.14.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react'
import * as ReactDOM from 'react-dom'
import * as ReactJsxDevRuntime from 'react/jsx-dev-runtime'
import * as ReactJsxRuntime from 'react/jsx-runtime'
//@ts-expect-error TODO: current @types/react does not have exported types for this import
import * as ReactCompilerRuntime from 'react/compiler-runtime'

function getAltProxyForBindingsDEV(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react'
import * as ReactDOM from 'react-dom'
import * as ReactJsxDevRuntime from 'react/jsx-dev-runtime'
import * as ReactJsxRuntime from 'react/jsx-runtime'
//@ts-expect-error TODO: current @types/react does not have exported types for this import
import * as ReactCompilerRuntime from 'react/compiler-runtime'

// eslint-disable-next-line import/no-extraneous-dependencies
Expand Down
Loading

0 comments on commit ff95a32

Please sign in to comment.