-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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(types): Allow all HTML and SVG elements in render. #833
fix(types): Allow all HTML and SVG elements in render. #833
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit f36ab6e:
|
Codecov Report
@@ Coverage Diff @@
## master #833 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 4 4
Lines 140 140
Branches 28 28
=========================================
Hits 140 140 Continue to review full report at Codecov.
|
I've noticed there are also types for |
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've noticed there are also types for Node (less specific) and HTMLOrSVGElement (more specific). Could either of those be better?
Element
is the exact interface we need because that's what react-dom
supports. Practically HTMLOrSVGElement
works because only HTMLElement
and SVGElement
extend Element
. But we don't need any properties from HTMLOrSVGElement
so we should stick with the correct type.
Node
would allow non-sense like Attr
nodes or Text
nodes.
Though there could be some fallout if we're now to generic for practical purposes. We'll see in the issue reports if we should add a type parameter for the container or if |
🎉 This PR is included in version 11.2.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
What:
Types disallowed SVG elements, see #830.
Why:
To allow both HTML and SVG elements to be passed to React Testing Library functions without throwing type errors in TypeScript.
How:
Exchanged
HTMLElement
type for the broaderElement
type that encompasses all elements that can appear in the DOM, not just HTML.Checklist:
docs site N/A