Skip to content

feat: add generic types support for render result queries#566

Merged
timdeschryver merged 1 commit intotesting-library:mainfrom
MattijsE:feature-allow-generic-type-on-queries-from-render-result
Feb 13, 2026
Merged

feat: add generic types support for render result queries#566
timdeschryver merged 1 commit intotesting-library:mainfrom
MattijsE:feature-allow-generic-type-on-queries-from-render-result

Conversation

@MattijsE
Copy link
Contributor

Add support for generic typings to the query methods on RenderResult. This makes it the same behaviour as screen.getByxxx methods. Previously is always returned HTMLElement.

With this change it's possible to pass a generic to get access to a more specific HTMLElement to prevent type assertions later.

@timdeschryver timdeschryver merged commit 749c94d into testing-library:main Feb 13, 2026
6 checks passed
@timdeschryver
Copy link
Member

@all-contributors please add @MattijsE for code

@allcontributors
Copy link
Contributor

@timdeschryver

I've put up a pull request to add @MattijsE! 🎉

@github-actions
Copy link

🎉 This PR is included in version 19.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@MattijsE MattijsE deleted the feature-allow-generic-type-on-queries-from-render-result branch February 13, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants