Comments (6)
For now, a workaround is to patch next
to remove its checking on whether @types/react
exists during next build
. I have to admit this workaround is quite hacky, but it will do the job before a proper fix is landed/React moves types-react
back to @types/react
.
diff --git a/node_modules/next/dist/lib/verify-typescript-setup.js b/node_modules/next/dist/lib/verify-typescript-setup.js
index 23998d8..da91cf4 100644
--- a/node_modules/next/dist/lib/verify-typescript-setup.js
+++ b/node_modules/next/dist/lib/verify-typescript-setup.js
@@ -72,11 +72,6 @@ const requiredPackages = [
pkg: 'typescript',
exportsRestrict: true
},
- {
- file: '@types/react/index.d.ts',
- pkg: '@types/react',
- exportsRestrict: true
- },
{
file: '@types/node/index.d.ts',
pkg: '@types/node',
from next.js.
I am using
react 19
with next canary14.3.0-canary.58
"@types/react": "18.2.74", "@types/react-dom": "18.2.23",
It will work for the most part, but again @types/react*@^18
is meant to be used with React 18, not 19. There are some differences in the API between the two versions.
e.g.
// initial value for useRef() is now mandatory for React 19,
// but @types/react@^18 won't complain on that if it's missing
const ref = useRef(null);
// refs are now always mutable in React 19 due to the previous change in API,
// but @types/react@^18 will complain about this line, since refs with initial values are read-only in React 18
ref.current = newValue;
from next.js.
I suspect it is caused by the name of @types/react
being changed to types-react
in package.json
and this affects how resolveFrom
works.
from next.js.
I am using react 19
with next canary 14.3.0-canary.58
"@types/react": "18.2.74",
"@types/react-dom": "18.2.23",
You can check the Portfolio and my Repo
from next.js.
I guess this is still something that was tackled in #65058 and needs to be to make us able to use react 19 beta in nextjs canary
from next.js.
Hey @mwskwong typings are now working correctly with nextjs 15 RC and using the following type dependencies:
package.json
"dependencies": {
"next": "15.0.0-rc.0",
"react": "19.0.0-rc-935180c7e0-20240524",
"react-dom": "19.0.0-rc-935180c7e0-20240524",
},
"devDependencies": {
"@types/react": "npm:[email protected]",
"@types/react-dom": "npm:[email protected]",
},
from next.js.
Related Issues (20)
- Duplicate Requests in Next.js 14 on Server Side with Parallel Routes and Intercepting Routes
- `router.replace()` on pages with query params cause entire page re-render on Next 14.2.3 HOT 1
- Form state not updating and suspended components reloading on first server action submission when using revalidatePath with loading.tsx in app router HOT 1
- `router.replace()` on pages with query params cause entire page re-render on Next 14.2.3 HOT 1
- Suspense boundary broken (ignored) after second server action call HOT 8
- Nonce exposed to the DOM
- [Bug][Next.js13]: renderError does not follow the err info of __NEXT_DATA__ when hytrate in client
- Docs: Wrong link for UseFormState. HOT 3
- `no-store` cache in nextjs config doesn't disable disk caching. HOT 1
- The `maxDuration` setting in the api route config, as per the documentation, isn't being honored on dev or on Vercel. We're on the pro plan. HOT 1
- TypeError: Cannot read properties of undefined (reading 'ReactCurrentOwner') when rendering model using react-three libraries HOT 1
- next/og don't work when turbo is enabled in dev HOT 1
- Metadata is not generated for intercepting routes HOT 1
- Monorepo self-referencing package imports don't resolve in certain cases with Turbopack
- Creating instance of URL with basePath gets mangled HOT 1
- Creating instance of URL with basePath gets mangled
- Regression since `v14.2.0-canary.24`: `loading.tsx` triggered on first `revalidatePath()` call HOT 2
- Nested parallel routes slot rendered after navigating back HOT 3
- graphql-request and caching HOT 4
- Client side navigation not working properly in latest next@rc for dev HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next.js.