-
-
Notifications
You must be signed in to change notification settings - Fork 173
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
Should treat optional peer dependencies as similar to Unlisted dependencies
#194
Comments
Yes good idea, I had this in the back of my mind, but never got around to implement it. Feel free to start working on this! I'll notify here if/when I start myself (I don't have time next ~10 days). We can look at the bonus after landing this. |
@webpro Do you think it should be a |
I think this warrants a new issue type |
Scratch that, the reasoning is not that it's unlisted or not. It is unlisted, but it's good to make it clear that it's not a regular (dev) dependency. So yes a new issue type (but for another reason). I also distinguish regular exports and namespaced exports. Good UX, imho. |
Started looking into this. Just to be sure, all of this is in |
No, in ordinary mode for me |
🚀 This issue has been resolved in v2.21.0-op.0. See Release 2.21.0-op.0 for release notes. |
Added the Would be great if you could try it as well :) |
Note to self: When opening an issue like this, include a personal reference to which project you experienced the issue in 😆 @webpro I'll try testing it, I will just need to find the correct project again 👍 |
Haha no worries. You could also work in (and maybe improve) the |
Found it: https://github.com/voxpelli/umzeption And yeah, it works 👍 One reflection: If I add
(Also, I'm not using |
🚀 This issue has been resolved in v2.22.0. See Release 2.22.0 for release notes. |
Thanks for the insights Pelle, this has landed. |
In a project of mine I correctly got:
Though since I want that dependency to be optional I added:
Since its optional there's still no guarantee that it will be available, hence I expected the
Unlisted dependencies
error to remain or be replaced with something likeRelying on optional dependency
Bonus feature request:
Since I myself only directly use these for types I use a trick I started using years ago in declaration files: I add a
@ts-ignore
on top of them:That makes it so that
Pool
andPoolClient
has their correct values when the types are available and else they will beany
.If
knip
could detect this and silence aRelying on optional dependency
error but still do aUnlisted dependencies
if I haven't listed them as optional peer dependencies, then that would be very very sweet.(Tell me if you would want me to try and make a PR for this)
The text was updated successfully, but these errors were encountered: