Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What: Adding typescript definitions
Why: The types for some parts of the dom-testing-library are currently in use in react-testing-library. Really these should be stored alongside the appropriate code and then imported as needed.
How: Added d.ts files with definitions to match functions. Some definitions pulled from react-testing-library (thanks @alexkrolick and @InExtremaRes).
Checklist:
I think adding dtslint is a good first step as far as keeping the definition files tested and avoiding types issues (as per testing-library/react-testing-library#82).
The types are only compatible with TypeScript 2.8 and up, because I've used mapped types for the bindElementToQueries function. It's possible to avoid using mapped types, but it means duplication of a lot of the queries code, and I think it's better to avoid that.
If you're happy with these types, I can update the react-testing-library to use them once everything has been merged.