You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've found myself repeating the same pattern of typecasting elements returned from queries when using render when I need to access specific element properties as the return type for queries is always HTMLElement as seen in the two below screenshots:
Suggested implementation:
Firstly I thought about using function overloads and literal types to fix this problem but then realised any HTML element can be assigned a role so I then thought about using generics and came across this old issue which was implemented several years ago. In that thread it said the generics got lost when using screen, which was addressed and fixed but it looks like the same problem applies to render.
Describe the feature you'd like:
Happy to give this a try myself!
I've found myself repeating the same pattern of typecasting elements returned from queries when using
render
when I need to access specific element properties as the return type for queries is alwaysHTMLElement
as seen in the two below screenshots:Suggested implementation:
Firstly I thought about using function overloads and literal types to fix this problem but then realised any HTML element can be assigned a
role
so I then thought about using generics and came across this old issue which was implemented several years ago. In that thread it said the generics got lost when usingscreen
, which was addressed and fixed but it looks like the same problem applies torender
.I imagine the fix will be similar to that found when adding generics to screen queries
Describe alternatives you've considered:
Open to suggestions
Teachability, Documentation, Adoption, Migration Strategy:
Allow users to pass generics to queries returned from
render
:The text was updated successfully, but these errors were encountered: