-
Notifications
You must be signed in to change notification settings - Fork 399
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
Move Types from @types/* to this repo #314
Comments
Usually there have been more difficulty with our repo than with other libs in the testing-library org because unlike other libs, this one is not used via direct imports. That usually has been a blocker. For instance, we used to have the types baked in, and we had to extract them because it did not work properly with VSCode intellisense. See #123 for instance. There was even an effort to port the actual source code to TypeScript (see #246) and it too introduced some issues that made it not suitable for a release. That being said, I'd be glad if we can pull it off provided it is done so that all the previous issues that we've had with this would not come back. |
Thanks @gnapse, I wasn't aware of the previous attempts that led to us moving this to Definitely-Typed. |
I gotta say, the barrier of entry to contribute types via having to do it in |
cc @testing-library/all-maintainers in case someone has some ideas on how to pull this off. |
If I remember correctly there wasn't much to it.
|
I think another reason in favour of this proposal would be compatibility with stricter node linkers. I'm finding that when using For example, the node modules structure may look something like this...
So In these cases I am having to add In contrast, compared to other extensions to jest matchers like I'd be happy to submit a PR to implement @eps1lon's suggestion if everyone is happy with that approach? |
It'd be awesome if you do that @jdanil. Can you please also keep in mind the difficulties we found when previously attempting this in #246? Although in that case it was different: the actual code was migrated to TS. Maybe having just type definitions and keeping the code in JS is sufficiently different to not cause any troubles. |
Ok I had a bit of a play around today. I think if the types are moved to this package, then the issue in #246 is unavoidable (that you need to explicitly import An alternative I was playing around with that doesn't necessarily resolve this issue of moving the type definitions, but avoids the need to add |
I think the way this should be solved is a declaration file in this repo that imports the matcher types from the modules (might use declaration files as a stepping stone while converting modules to TS) and augments the From there it should be a dual approach:
|
Can you go ahead with a PR? We could do the same we did with #246, publishing a beta or alpha release to see if it all works as expected when this gets published. |
Couldn't we solve this problem by recommending to use |
Or adding to the |
🎉 This issue has been resolved in version 6.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Describe the feature you'd like:
Following this comment and this issue, we would like to move the types to this repo also.
Suggested implementation:
Here's a PR done in dom-testing-library:
testing-library/dom-testing-library#530
The text was updated successfully, but these errors were encountered: