-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(TS): add queries typings #259
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
fix(TS): add queries typings #259
Conversation
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.
I'm not good enough at typescript yet to know whether this is 👍 but I'll go ahead and merge it and hope that it is 😬
Thanks! |
🎉 This PR is included in version 5.4.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
|
||
export * from 'dom-testing-library' | ||
|
||
type GetsAndQueries = ReturnType<typeof getQueriesForElement> | ||
interface Query extends Function { | ||
(container: HTMLElement, ...args): HTMLElement[] | HTMLElement | null |
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.
@chochihim @kentcdodds heads up, the ...args
expression here causes TS builds to fail when --noImplicitAny
is set.
Type error: Rest parameter 'args' implicitly has an 'any[]' type. TS7019
4 |
5 | interface Query extends Function {
> 6 | (container: HTMLElement, ...args): HTMLElement[] | HTMLElement | null
| ^
7 | }
8 |
9 | interface Queries {
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.
😬
Could you please open a PR to fix this @joeporpeglia.
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.
Gotcha! #260
* docs: update README.md * docs: update .all-contributorsrc Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
What: Add typings for queries in RenderOptions
Why: It's missing. Also in a project I need to add some custom queries.
How:
Checklist:
The implementation is trickier than I thought. Any comment is appreciated. Also
Query
andQueries
should probably be declared indom-testing-library
. I can create another PR once the implementation of this PR is accepted.