[Bug?]: Typescript project throws an error when moving towards nodeLinker: pnp
#6482
Labels
bug
Something isn't working
stale
Issues that didn't get attention
waiting for feedback
Will autoclose in a while unless more data are provided
Self-service
Describe the bug
I tried to migrate the enterprise repo from
node_modules
topnp
vianodeLinker
.With this setup, I have no issues with file extensions .jsx. But when I have the files with .tsx, I face issues with typescript, which says
For example, for react we have @types/react and it fails to identify react. But this problem is only with .tsx files. When we have the same code with .jsx, there is no issue at all.
Also if I install the dependencies at the package level, this also works. So the only thing which is not working is the dependencies at the root level.
Previously with yarn classic or yarn berry with
nodeLinker: node_modules
, we hadtypeRoots
option in tsconfig.json which has the value./node_modules/@types
. But with yarn pnp, we dont have node_modules. So I guess this is causing the issue hereAnyway the other dependenices within monorepo works fine without any issues
P.S: I tried to indicate vscode to read the deps from zip file as explained here => https://yarnpkg.com/migration/pnp#editor-support
Any advice on the steps that I can take to figure out why types definiton is not working here?
To reproduce
main setting in package.json
.yarnrc.yml
tsconfig.base.json
vscode settings.json
Environment
System: OS: macOS 14.6.1 CPU: (10) arm64 Apple M1 Pro Binaries: Node: 20.9.0 - /private/var/folders/cn/fqzzvl0x3xbbxj4f5h9y89xm0000gq/T/xfs-4a910746/node Yarn: 4.4.1 - /private/var/folders/cn/fqzzvl0x3xbbxj4f5h9y89xm0000gq/T/xfs-4a910746/yarn npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
Additional context
No response
The text was updated successfully, but these errors were encountered: