[React 19] The namespace type in @types/react/index.d.ts causes problems.
jin-Pro opened this issue · 1 comments
Summary
Hello, I am creating a service using monorepo structure via pnpm.
The development environment is as follows:
-pnpm
- @types/react18
- @types/react19
- react18
- react19
my-monorepo/
├── package.json
├── node_modules/
│ └── .pnpm/
└── apps/
├── project-a/
│ ├── package.json
│ └── node_modules/
│ ├── react/ # React 18
│ │ └── ...
│ └── @types/
│ └── react/ # @types/react 18
└── project-b/
├── package.json
└── node_modules/
├── react/ # React 19
└── @types/
└── react/ # @types/react 19
I am working on a project with the above structure.
A type error related to ReactNode
occurs in apps/project-b using react v19
.
The cause of the problem I thought was
This problem occurred because the declare namespace React
statement declared in index.d.ts
inside root/node_modules/@types+react18
and root/node_modules/@types+react19
were merged due to hoist in the package manager. I think.
This is an error caused by the type of react.
Would you recognize this as a problem?
There was a request on the DT repo as well to remove the declare namespace
. I don't know if that's safe to do and doesn't cause other breakages. I recommend filing a PR against https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react and see if this is compatible against every other @types/
package. Then we can discuss a rollout plan.