Title: ngIf with async pipe causes new template type checking errors when template variables are used in rc.5 · Issue #34572 · angular/angular · GitHub
Open Graph Title: ngIf with async pipe causes new template type checking errors when template variables are used in rc.5 · Issue #34572 · angular/angular
X Title: ngIf with async pipe causes new template type checking errors when template variables are used in rc.5 · Issue #34572 · angular/angular
Description: 🐞 bug report Affected Package @angular/common Is this a regression? Yes, it wasn't an issue in Angular 9.0.0-rc.4. Description Template X Description: 🐞 bug report Affected Package @angular/common Is this a regression? Yes, it wasn't an issue in Angular 9.0.0-rc.4. Description Template <ng-container *ngIf="componentViewer.componentDoc...
Opengraph URL: https://github.com/angular/angular/issues/34572
X: @github
Domain: github.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ngIf with async pipe causes new template type checking errors when template variables are used in rc.5","articleBody":"# 🐞 bug report\r\n\r\n### Affected Package\r\n`@angular/common`\r\n\r\n### Is this a regression?\r\n\r\nYes, it wasn't an issue in Angular `9.0.0-rc.4`.\r\n\r\n### Description\r\n\r\n#### Template\r\n```html\r\n\u003cng-container *ngIf=\"componentViewer.componentDocItem | async; let docItem\">\r\n \u003cspan class=\"cdk-visually-hidden\" tabindex=\"-1\" #initialFocusTarget>\r\n Examples for {{docItem.id}}\r\n \u003c/span>\r\n \u003cexample-viewer *ngFor=\"let example of docItem.examples\"\r\n [example]=\"example\">\u003c/example-viewer>\r\n\u003c/ng-container>\r\n```\r\nThere are errors for\r\n```\r\nsrc/app/pages/component-viewer/component-examples.html:3:20 - error TS2531: Object is possibly 'null'.\r\n\r\n3 Examples for {{docItem.id}}\r\n ~~~~~~~~~~\r\n\r\n src/app/pages/component-viewer/component-viewer.ts:132:16\r\n 132 templateUrl: './component-examples.html',\r\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n Error occurs in the template of component ComponentExamples.\r\nsrc/app/pages/component-viewer/component-examples.html:5:34 - error TS2531: Object is possibly 'null'.\r\n\r\n5 \u003cexample-viewer *ngFor=\"let example of docItem.examples\" [example]=\"example\">\u003c/example-viewer>\r\n ~~~~~~~~~~~~~~~~\r\n\r\n src/app/pages/component-viewer/component-viewer.ts:132:16\r\n 132 templateUrl: './component-examples.html',\r\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n Error occurs in the template of component ComponentExamples.\r\n```\r\n\r\n#### Solutions?\r\n\r\nIt's complaining about `docItem.id` and `docItem.examples` where `docItem` might be `null` in these cases. But it seems to be ignoring the fact that this template won't be rendered if `docItem` is `null`. It appears that the type narrowing is not working properly in this case?\r\n\r\nThe tests in PR https://github.com/angular/angular/pull/33997 don't cover the use case where the Async Pipe is used with `let`. But `\u003cng-container *ngIf=\"componentViewer.componentDocItem | async as docItem\">` also seems to trigger this error.\r\n\r\nHow do you recommend developers solve this very common use case?\r\n- Answer so far is that this is a bug that needs to be resolved for `v9`.\r\n\r\n## 🔬 Minimal Reproduction\r\nHere is the [workaround](https://github.com/angular/material.angular.io/commit/f813cc6d0c12bc52dab5237922403fcde4108e72) that I had to apply to get our repo building again after the breaking change in Angular `9.0.0-rc.5`. \r\n\r\n## 🔥 Exception or Error\r\n```\r\nsrc/app/pages/component-viewer/component-examples.html:3:20 - error TS2531: Object is possibly 'null'.\r\n\r\n3 Examples for {{docItem.id}}\r\n ~~~~~~~~~~\r\n\r\n src/app/pages/component-viewer/component-viewer.ts:132:16\r\n 132 templateUrl: './component-examples.html',\r\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n Error occurs in the template of component ComponentExamples.\r\nsrc/app/pages/component-viewer/component-examples.html:5:34 - error TS2531: Object is possibly 'null'.\r\n\r\n5 \u003cexample-viewer *ngFor=\"let example of docItem.examples\" [example]=\"example\">\u003c/example-viewer>\r\n ~~~~~~~~~~~~~~~~\r\n\r\n src/app/pages/component-viewer/component-viewer.ts:132:16\r\n 132 templateUrl: './component-examples.html',\r\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n Error occurs in the template of component ComponentExamples.\r\n```\r\n\r\n## 🌍 Your Environment\r\n\r\n**Angular Version:**\r\n\u003cpre>\u003ccode>\r\nAngular CLI: 9.0.0-rc.6\r\nNode: 12.13.0\r\nOS: darwin x64\r\n\r\nAngular: 9.0.0-rc.7\r\n... animations, common, compiler, compiler-cli, core, forms\r\n... localize, platform-browser, platform-browser-dynamic, router\r\nIvy Workspace: Yes\r\n\r\nPackage Version\r\n------------------------------------------------------------\r\n@angular-devkit/architect 0.900.0-rc.6\r\n@angular-devkit/build-angular 0.900.0-rc.6\r\n@angular-devkit/build-optimizer 0.900.0-rc.6\r\n@angular-devkit/build-webpack 0.900.0-rc.6\r\n@angular-devkit/core 9.0.0-rc.6\r\n@angular-devkit/schematics 9.0.0-rc.6\r\n@angular/cdk 9.0.0-rc.5\r\n@angular/cdk-experimental 9.0.0-rc.5\r\n@angular/cli 9.0.0-rc.6\r\n@angular/components-examples 9.0.0-rc.5-sha-8796d7cc6\r\n@angular/google-maps 9.0.0-rc.5\r\n@angular/material 9.0.0-rc.5\r\n@angular/material-experimental 9.0.0-rc.5\r\n@angular/material-moment-adapter 9.0.0-rc.5\r\n@angular/youtube-player 9.0.0-rc.5\r\n@ngtools/webpack 9.0.0-rc.6\r\n@schematics/angular 9.0.0-rc.6\r\n@schematics/update 0.900.0-rc.6\r\nrxjs 6.5.3\r\ntypescript 3.6.4\r\nwebpack 4.41.2\r\n\u003c/code>\u003c/pre>\r\n\r\n**Anything else relevant?**\r\n\r\n@JoostK has been investigating this and has posted some comments about this here\r\n- https://github.com/angular/material.angular.io/pull/689#issuecomment-566371176\r\n- https://github.com/angular/material.angular.io/pull/689#issuecomment-567629433\r\n","author":{"url":"https://github.com/Splaktar","@type":"Person","name":"Splaktar"},"datePublished":"2019-12-27T02:36:43Z","url":"https://github.com/angular/angular/issues/34572"}
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:46a9947b-280e-d3e3-f700-0901525fb99c current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id E8C4:62283:DEBA11:128217D:6B00FE76 html-safe-nonce b80b011eec9bc2167bc0f4e7b577cc1745e2a04d83687c658ea3006b967c8e22 visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOEM0OjYyMjgzOkRFQkExMToxMjgyMTdEOjZCMDBGRTc2IiwidmlzaXRvcl9pZCI6IjQ1NzMwMDI4MjE3NDU1NzM0OTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== visitor-hmac a818e816839b8bb6a6939a37763ae7592a3bb55aa9d56b5bf95255c8422de8ad hovercard-subject-tag issue:542720719 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/34572/issue_layout twitter:image https://opengraph.githubassets.com/843f225a4f1ccdc4609e5221b1e08f23757d6e99fcd56f2463ad94a8bce49572/angular/angular/issues/34572 twitter:card summary_large_image og:image https://opengraph.githubassets.com/843f225a4f1ccdc4609e5221b1e08f23757d6e99fcd56f2463ad94a8bce49572/angular/angular/issues/34572 og:image:alt 🐞 bug report Affected Package @angular/common Is this a regression? Yes, it wasn't an issue in Angular 9.0.0-rc.4. Description Template og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username Splaktar hostname github.com expected-hostname github.com None e208d86428ec00a57ade75058166297440e8128a01e5287c31a53dc042bbf187 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 7dafd017fb7809a839c443dba08622af38e63c09 ui-target full theme-color #1e2327 color-scheme light dark react-app-name issues
URLs of crawlers that visited me.