-
Notifications
You must be signed in to change notification settings - Fork 20
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
Yarn v2 issue with @types #14
Comments
For the second one I remember seeing that before, but I haven't got time to investigate yet 🤔 For the third one, that looks weird as well but at least the types definition are found. My best guess would be that the version of |
Weird, with
4.16.9 is actually the latest version listed on npm: https://www.npmjs.com/package/@types/express-serve-static-core |
For the second one, with
|
I suspect the answer might be in ts-pnp: https://github.com/arcanis/ts-pnp/blob/master/index.js. But I don't know how to monkey patch (as packages are stored as zip files) or debug ( Do you know what is the recommended way to debug in such situations? |
Two options:
I think you're right btw - looking at this line, it's clear that the resolution is made from the top-level of the project (which is obtained from |
I confirm. At https://github.com/arcanis/ts-pnp/blob/master/index.js#L22, Replacing pnp.resolveToUnqualified(typesPackagePath, `${topLevelLocation}/`, {considerBuiltins: false}); by pnp.resolveToUnqualified(typesPackagePath, issuer, {considerBuiltins: false}); fix my issue and the example compiles as expected! But I am not confident in creating a PR for the issue 😅 |
I vaguely remember that it was because of an oddity with the way the |
I'm running into this same issue by trying to run a stock I get errors about
Now I get errors about
This looks like a problem with
Could you please shed some light on these questions?
|
I hit this as well while experimenting a bit with yarn v2 to get a feel for how difficult migration will ultimately be. Unplugging and patching ts-pnp as described here got me unblocked (thank you!).
If this turns out to be the case it would be a pretty hard blocker for us being able to adopt v2. We have a pretty massive TypeScript monorepo (hundreds of packages) and rely heavily on each of them declaring their |
This is a big blocker to me. |
The @types issue is solved by changing the above lines, but (with or without this change) TS cannot find the normal type files for packages that publish their own typescript files - see: yarnpkg/berry#1483 I'm not 100% sure where to post about this issue - does anyone know or have an idea of how to tackle it? |
Just to clarify, my issue can be reproduced by cloning https://github.com/alubbe/yarn2_workspace_typescript and running |
I hate to bump my own ticket, but this issue is causing major headaches for us - is there anything we can do to help investigate this further? Is this even the right place to report the issue? Why does TS find all the JS files just fine, but struggle to find a dependency's own type declaration file? Any pointers would be extremely helpful! |
Fixed by yarnpkg/berry#1483 (comment) |
I am testing
pnp-webpack-plugin
with yarn v2 (2.0.0-rc.1, but same output with 2.0.0-rc.6).It works well with JS: https://github.com/vhiairrassary/test-yarn-v2.
When I want to use typescript, I can't use
@types
packages. The code now is https://github.com/vhiairrassary/test-yarn-v2/compare/ts?expand=1.@types/express
, I get the following error, which is normalAdding to the package using
yarn workspace @mytest/a add @types/express
results in the same error as above, but here it should work out of the box.Adding to the root package using
yarn workspace @mytest/root add @types/express
:Which is really weird as send is part of Response.
Am I missing something?
The text was updated successfully, but these errors were encountered: