-
Notifications
You must be signed in to change notification settings - Fork 27k
Closed
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsarea: coreIssues related to the framework runtimeIssues related to the framework runtimecore: queriescross-cutting: typesfeatureIssue that requests a new featureIssue that requests a new featurefeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationfreq2: medium
Milestone
Description
🐞 bug report
Affected Package
The issue is caused by package @angular/core.
Is this a regression?
No, it has never worked properly.
Description
Using a type guard as the argument for the QueryList#filter method doesn't narrow the type of the resulting array as expected. It's expected because it works when using Array#filter, which the documentation tells me to see.
🔬 Minimal Reproduction
https://stackblitz.com/edit/angular-ivy-maecij?file=src%2Fapp%2Fapp.component.ts
See line 24, and compare with 26-29.
🔥 Exception or Error
Property 'hello' does not exist on type 'HelloComponent | ByeComponent'.
Property 'hello' does not exist on type 'ByeComponent'.
🌍 Your Environment
Angular Version: all
The fix is trivial and can be seen here:
Harpush, Michael-Ziluck and samuelfernandez
Metadata
Metadata
Assignees
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsarea: coreIssues related to the framework runtimeIssues related to the framework runtimecore: queriescross-cutting: typesfeatureIssue that requests a new featureIssue that requests a new featurefeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationfreq2: medium