Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next throws error when React 19 types (@types/react and @types/react-dom) are installed #65957

Closed
AlessioGr opened this issue May 19, 2024 · 2 comments · Fixed by #66127
Closed
Assignees
Labels
bug Issue was opened via the bug report template. TypeScript Related to types with Next.js.

Comments

@AlessioGr
Copy link
Contributor

Link to the code that reproduces this issue

https://github.com/AlessioGr/next.js/blob/99daf9a9643e5c11f31cad46d0cb345d0be2cafb/test/production/ci-missing-typescript-deps/index.test.ts#L39

To Reproduce

Run the test in my reproduction, or install the proper React 19 @types/react and @types/react-dom versions as outlined here: DefinitelyTyped/DefinitelyTyped#69022 - then run next dev

Current vs. Expected behavior

Current:
CleanShot 2024-05-19 at 17 42 53

Expected: does not throw an error

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:37 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6031
  Available memory (MB): 65536
  Available CPU cores: 16
Binaries:
  Node: 22.1.0
  npm: 10.7.0
  Yarn: 1.22.22
  pnpm: 8.15.7
Relevant Packages:
  next: 14.3.0-canary.70 // Latest available version is detected (14.3.0-canary.70).
  eslint-config-next: N/A
  react: 19.0.0-rc-915b914b3a-20240515
  react-dom: 19.0.0-rc-915b914b3a-20240515
  typescript: 5.4.5
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

TypeScript

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local)

Additional context

No response

@AlessioGr AlessioGr added the bug Issue was opened via the bug report template. label May 19, 2024
@github-actions github-actions bot added the TypeScript Related to types with Next.js. label May 19, 2024
@amlcodes
Copy link

amlcodes commented May 21, 2024

running into this right now including next build (hosted vercel), bump. I used the react upgrade guide which uses the "beta" tag and overrides for the @types/react and @types/react-dom packages

@wujekbizon
Copy link

I'm running React 19.0.0-beta-26f2496093-20240514 and Next.js 14.3.0-canary.73. I also failed my Vercel build because of this:

...
...
[17:23:40.314] dependencies:
[17:23:40.314] - @tanstack/react-query 5.36.2
[17:23:40.315] + @tanstack/react-query 5.37.1
[17:23:40.315] - @tanstack/react-query-devtools 5.36.2
[17:23:40.315] + @tanstack/react-query-devtools 5.37.1
[17:23:40.320] + @types/react <- types-react 19.0.0-beta.1
[17:23:40.321] + @types/react-dom <- types-react-dom 19.0.0-beta.1
[17:23:40.321] + babel-plugin-react-compiler 0.0.0-experimental-c23de8d-20240515
[17:23:40.321] - next 14.3.0-canary.63
[17:23:40.321] + next 14.3.0-canary.73
...
...
[17:24:15.187]   Compiled successfully
[17:24:15.189]    Linting and checking validity of types ...
[17:24:15.312] It looks like you're trying to use TypeScript but do not have the required package(s) installed.
[17:24:15.312] 
[17:24:15.312] Please install @types/react by running:
[17:24:15.313] 
[17:24:15.313] 	pnpm install --save-dev @types/react
[17:24:15.313] 
[17:24:15.313] If you are not trying to use TypeScript, please remove the tsconfig.json file from your package root (and any TypeScript files in your pages directory).
[17:24:15.313] 
[17:24:15.334]  ELIFECYCLE  Command failed with exit code 1.
[17:24:15.364] Error: Command "pnpm run build" exited with 1
[17:24:15.846] 

During local development, I found a hack to turn off the warning :
ts_change

Still don't know how to get around this issue. Any idea someone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. TypeScript Related to types with Next.js.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants