-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Typescript error with Next13, Monorepo (turbo repo), and Async components #55080
Labels
Comments
I just updated a working turbo repo from 13.4.3 i think to 13.5.3 and now almost every shadcn component is kicking this out.
There are a TON of them. |
upgrade @types/react fixed this |
leerob
added a commit
that referenced
this issue
Oct 27, 2023
### What? When I ran `npx create-next-app --example with-turbopack` and installed dependencies using `yarn`, I found an typescript error(`'SomeComponent' cannot be used as a JSX component.`). <img src="https://github.com/vercel/next.js/assets/51700274/f6c7e478-c0b1-4ea2-996f-4c0c78e3bb4b" width=400 /> and I realized that the bug is due to the version of @types/react(18.0.x). you can check this issue on [here](#42292 (comment)) too. ### Why? It seems that there is an error occurring in the @types/react version 18.0.x. ### How? It would be good to change the @types/react version to 18.2.8 in the next.js examples. I think this change will resolve [this issue](#55080 (comment)) [NestJS documentation](https://nextjs.org/docs/app/building-your-application/configuring/typescript#async-server-component-typescript-error) also states to upgrade the version. Co-authored-by: Lee Robinson <me@leerob.io> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Link to the code that reproduces this issue or a replay of the bug
https://github.com/dannytlake/next-13-turbo-async-bug
To Reproduce
Note, the reference repo was created by running
pnpm dlx create-turbo@latest
apps/web/app/page.tsx
, the async componentAsyncComponent
should be causing a typescript error on line 62.'AsyncComponent' cannot be used as a JSX component. Its return type 'Promise<Element>' is not a valid JSX element. Type 'Promise<Element>' is missing the following properties from type 'ReactElement<any, any>': type, props, keyts(27
When setting VSCode to use the workspace typescript version by running
TypeScript: Select TypeScript Version...
and choosing workspace version of 5.2.2, the error persists.Current vs. Expected behavior
When building a nextjs application inside a monorepo, there should be no typescript error when using an async component inside a RSC component in the App Router
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: x64 Version: Darwin Kernel Version 20.6.0: Wed Nov 10 22:23:07 PST 2021; root:xnu-7195.141.14~1/RELEASE_X86_64 Binaries: Node: 18.14.0 npm: 9.3.1 Yarn: 1.22.19 pnpm: 8.6.6 Relevant Packages: next: 13.4.20-canary.18 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 4.9.5 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
App Router, TypeScript (plugin, built-in types)
Additional context
This doesn't seem to be related specifically to VSCode, I had folks open the repo in webstorm as well and they experienced the same issue.
The text was updated successfully, but these errors were encountered: