feat(@jest/types): infer argument types passed to test
and describe
functions from each
tables
#12885
+1,114
−308
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.
Summary
This PR is filling one more gap of types. Currently types of arguments passed from
each
tables totest
anddescribe
functions areany
. In this field,@types/jest
does better job. I was playing with for some time. The solutions is different than the one from DT – somewhat better, but with some limitations. Documentation noting the caveats is included (by the way, types from DT has similar issues).Probably I will have to revisit it later, but that is a strong start already.
Test plan
The detailed type tests for
each
now live in a separate file. The type tests for global API were cleaned up and slightly extended. Could not leave them. Apologies for many tests. Just wanted to be sure that everything works.