-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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(core): Allow typeguards on QueryList.filter #48042
feat(core): Allow typeguards on QueryList.filter #48042
Conversation
b6b16fd
to
c6c458e
Compare
I'm also thinking about including the fix for #39602 in this PR. Edit: No need for that, it was fixed from TS 4.2 onwards. |
Just a quick note to myself: the typings for the |
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.
@JeanMeche thanks for the PR! I've checked that the typings of the QueryList.filter
are similar to the typings of the Array.filter
method.
This change might introduce a breaking change in apps code. The possibility is very low, so we probably won't need a schematic to migrate the code (we'll be able to tell precisely after running tests in Google's codebase), but we'd be able to include this change only into the next major version (v16) according to the SemVer. I've added this PR to the "v16-candidates" Github milestone and we'll get back to this PR once the main branch is open for v16 changes (which will happen after releasing the last v15.x minor version).
Thank you.
@AndrewKushnir this look it is good to go, right? |
c6c458e
to
d6e4993
Compare
@pkozlowski-opensource yes, it should be ready for merge after one more TGP (just in case). Will update the PR once I have TGP results. |
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.
Reviewed-for: fw-core, public-api
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.
reviewed-for: public-api
d6e4993
to
ee0728c
Compare
ee0728c
to
57d8823
Compare
To match the behaviour of Array.filter, typeguards can now be used on QueryList.filter to narrow the return type. Fixes angular#38446 BREAKING CHANGE: QueryList.filter now supports type guard functions, which will result in type narrowing. Previously if you used type guard functions, it resulted in no changes to the return type. Now the type would be narrowed, which might require updates to the application code that relied on the old behavior.
57d8823
to
a5fd73e
Compare
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.
Reviewed-for: public-api
Caretaker note: TGP is "green", this PR is ready for merge. |
This PR was merged into the repository by commit b2327f4. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
To match the behaviour of Array.filter, typeguards can now be used on QueryList.filter to narrow the return type.
Fixes #38446
PR Type
What kind of change does this PR introduce?
Does this PR introduce a breaking change?