-
Notifications
You must be signed in to change notification settings - Fork 470
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
fix(within): Add extra type paramater to allow reassigning in TypeScript #1077
Conversation
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 6e6515f:
|
Codecov Report
@@ Coverage Diff @@
## main #1077 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 25 25
Lines 954 954
Branches 314 314
=========================================
Hits 954 954
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I don't understand why this works so let's make sure this isn't easily reverted before checking git-blame
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea why this works. Added some more tests/comments to make sure this isn't reverted before checking git-blame.
@all-contributors add @robcaldecott for bug |
I could not determine your intention. Basic usage: @all-contributors please add @Someone for code, doc and infra For other usages see the documentation |
@all-contributors add @robcaldecott for bug |
@all-contributors add @Dennis273 for code |
I've put up a pull request to add @robcaldecott! 🎉 |
I've put up a pull request to add @Dennis273! 🎉 |
@all-contributors add @Dennis273 for code |
I've put up a pull request to add @Dennis273! 🎉 |
🎉 This PR is included in version 8.11.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What:
Closes testing-library/react-testing-library#979
TS error occurs when reassigning the return value of
within
https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgZwMZQKYYHYBo4DuwMAFsNnAL5wBmUEIcARAAIwbIzkDmAtADbAARlACGUAJ4B6ACYMmAbgBQoSLGZsJYDlIBWHGIpXho8Vu048BwsZL0HeckEaWoI2TnGyiAbsG6iXO5wALwo6FjYAHTcGDAAQhIAShD8GAAUTN5+AUHYTACUymnwIhiiMugAriBCyKGExGTY6dn+gcDuRUoYAB7aqDDpZRXVtcgxcYkpaZmC2ADWTPhI3iAYAFxwUiQMGFLAVAUFUTAQ8RgAktgAKiQYACIQqDU4Q90jlVA1dQ1EpORWr52nkikA
Why:
To avoid TS error or type-casting.
How:
The type error happens because TS tries to infer
T
from the variablebreadcrumbs
(BoundFunctions<T>
) in the demo above. This is fixed by adding another generic variableK
.Checklist:
docs site