-
Notifications
You must be signed in to change notification settings - Fork 405
docs: advise users to install typescript types #460
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
Conversation
Thanks for this. Somehow my project had inherited type declarations for the matchers from somewhere, but they conflicted with the most recently published version. Installing the latest |
If you're using vite, this is a godsend and the magic sauce to make
work in IDEA Intellij |
This shouldn't be necessary unless you're using a tool with strict dependency requirements like Yarn modern |
I use pnpm for most things, sounds about right. Why would strictness be a problem for supplying types? |
I'm using pnpm. |
Some package managers (including Yarn modern) only allow packages to import/require a dependency if it's declared as a dependency in its |
I think the crux of the issue is that The dependency on
|
See #123 for historical context. TL;DR: The testing library packages all used to do this until they started shipping their own types. But since It's hard to know whether this approach was overall more or less confusing for users since we only hear about the cases where it's causing friction. |
Thanks for the context! I’m not sure I completely understand the situation, but publishing a new version of |
Yeah, I suppose the For those cases, the types package should probably be a peer dependency, but then we lose the "just works" use case for people using npm without strict-peer-deps. Though maybe that isn't as relevant anymore as it was a few years ago. |
would you mind elaborating? I use Yarn 3 and I would expect it to resolve the issue for me when I next upgrade |
I guess it depends on how you have configured Yarn. From what I understand, PnP mode doesn't hoist dependencies to the root by default. So if
This is also how But maybe Yarn 3 with the |
With |
This is all very good information, thank you for sharing. Maybe I can expand the addition to the docs to include when doing this will be necessary? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
Just want to point out, you can opt out via dependency requirements with Yarn 3 using "core-js": {
"built": false
},
"source-map-resolve": {
"optional": true
}
}, |
Codecov Report
@@ Coverage Diff @@
## main #460 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 26 26
Lines 630 630
Branches 236 236
=========================================
Hits 630 630 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@waynevanson leaving this open for now in case you want to add anything. |
@nickmccurdy done. |
I am not using The solution was installing the types package as this documentation proposes. |
@nickmccurdy Do we need anything else to get this one in? |
I read the docs and installed it, but it didn't autocomplete types like |
🎉 This issue has been resolved in version 6.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What:
Information on installing typescript types from
@types/jest-dom__types
Why:
These instructions are critical for using Typescript, yet I haven't seen any instructions.
How:
In
readme.md
.I'm not sure what this question means, am I missing something?
Checklist: