Skip to content
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

feat: Add element type generic argument to queries #1023

Merged
merged 3 commits into from
Sep 11, 2021

Conversation

dfoverdx
Copy link
Contributor

@dfoverdx dfoverdx commented Sep 7, 2021

What: Adding generic return types to queries

Closes #615

Why:

It's frustrating doing wrapper.getByText('...') as HTMLAnchorElement everywhere just so I can access the href property

How: By altering the queries declaration file to allow specifying the type when calling the the query function.

Checklist:

  • Documentation added to the N/A
    docs site
  • Tests N/A
  • TypeScript definitions updated
  • Ready to be merged

This change is 100% backwards compatible.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 7, 2021

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 4bace52:

Sandbox Source
react-testing-library-examples Configuration

@codecov
Copy link

codecov bot commented Sep 8, 2021

Codecov Report

Merging #1023 (4bace52) into main (8311c8d) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##              main     #1023   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           25        25           
  Lines          916       916           
  Branches       286       286           
=========================================
  Hits           916       916           
Flag Coverage Δ
node-12 100.00% <ø> (ø)
node-14 100.00% <ø> (ø)
node-16.9.1 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8311c8d...4bace52. Read the comment docs.

@eps1lon eps1lon changed the title Added types to queries feat: Add element type generic argument to queries Sep 8, 2021
@eps1lon eps1lon added enhancement New feature or request TypeScript labels Sep 8, 2021
@eps1lon eps1lon merged commit f55f19b into testing-library:main Sep 11, 2021
@eps1lon
Copy link
Member

eps1lon commented Sep 11, 2021

@all-contributors add @dfoverdx for code

@allcontributors
Copy link
Contributor

@eps1lon

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

@github-actions
Copy link

🎉 This PR is included in version 8.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

Add generics to get/query methods
3 participants