Title: QueryList's filter method doesn't support type guards · Issue #38446 · angular/angular · GitHub
Open Graph Title: QueryList's filter method doesn't support type guards · Issue #38446 · angular/angular
X Title: QueryList's filter method doesn't support type guards · Issue #38446 · angular/angular
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...
Open Graph 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#...
X 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#...
Opengraph URL: https://github.com/angular/angular/issues/38446
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"QueryList's filter method doesn't support type guards","articleBody":"# 🐞 bug report\r\n\r\n### Affected Package\r\n\r\nThe issue is caused by package `@angular/core`.\r\n\r\n### Is this a regression?\r\n\r\nNo, it has never worked properly.\r\n\r\n### Description\r\n\r\nUsing 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](https://github.com/angular/angular/blob/25f79ba73e19bcf7c0925283a2dfdf2d9186eb49/packages/core/src/linker/query_list.ts#L83).\r\n\r\n## 🔬 Minimal Reproduction\r\n\r\nhttps://stackblitz.com/edit/angular-ivy-maecij?file=src%2Fapp%2Fapp.component.ts\r\n\r\nSee line 24, and compare with 26-29.\r\n\r\n## 🔥 Exception or Error\r\n\r\n```text\r\nProperty 'hello' does not exist on type 'HelloComponent | ByeComponent'.\r\n Property 'hello' does not exist on type 'ByeComponent'.\r\n```\r\n\r\n## 🌍 Your Environment\r\n\r\n**Angular Version:** all\r\n\r\n---\r\n\r\nThe fix is trivial and can be seen here:\r\n\r\nhttps://github.com/microsoft/TypeScript/blob/610fa28de55d37b0e46fa1cf6394da117d29be9d/src/lib/es5.d.ts#L1151-L1162\r\n","author":{"url":"https://github.com/lazarljubenovic","@type":"Person","name":"lazarljubenovic"},"datePublished":"2020-08-13T16:03:54Z","url":"https://github.com/angular/angular/issues/38446"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3cf5541d-f373-1c49-6e02-b64c34660211 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A70A:3897F3:A747B1:D9A7B6:6B00E769 |
| html-safe-nonce | a1956067d8c4b4347a932166154b7742c9b7ae1a9e88e39032c5828ae5851d40 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzBBOjM4OTdGMzpBNzQ3QjE6RDlBN0I2OjZCMDBFNzY5IiwidmlzaXRvcl9pZCI6Ijg5MjY5NjM3MDExNjkzMTc3MzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0bcd4af6609dafab78a499b5199f10b24fbf40b22673aed17ba5a54b05c1c976 |
| hovercard-subject-tag | issue:678553112 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/38446/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0467bf4fe7fd9b248de73d7d8a386742c401249fd6c07ef58a85aae4b4731020/angular/angular/issues/38446 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0467bf4fe7fd9b248de73d7d8a386742c401249fd6c07ef58a85aae4b4731020/angular/angular/issues/38446 |
| og:image:alt | 🐞 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#... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lazarljubenovic |
| hostname | github.com |
| expected-hostname | github.com |
| None | 27088b6977484d0d3321d9a11c907c6d6637b315cfa359ef7952dbf6292f9b14 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 624179fb8b88d26ba5bba08894eb60a1c5a1d93d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width