Title: @switch type narrowing doesn't work · Issue #52077 · angular/angular · GitHub
Open Graph Title: @switch type narrowing doesn't work · Issue #52077 · angular/angular
X Title: @switch type narrowing doesn't work · Issue #52077 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? compiler Is this a regression? No Description interface Base { type: 'foo' | 'bar' } interface Foo extends Base { type: 'foo'; foo: string; } interface Bar extends Base { type: 'bar'...
Open Graph Description: Which @angular/* package(s) are the source of the bug? compiler Is this a regression? No Description interface Base { type: 'foo' | 'bar' } interface Foo extends Base { type: 'foo'; foo: string; } ...
X Description: Which @angular/* package(s) are the source of the bug? compiler Is this a regression? No Description interface Base { type: 'foo' | 'bar' } interface Foo extends Base { type: 'f...
Opengraph URL: https://github.com/angular/angular/issues/52077
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"@switch type narrowing doesn't work","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\ncompiler\n\n### Is this a regression?\n\nNo\n\n### Description\n\n```ts\r\ninterface Base {\r\n type: 'foo' | 'bar'\r\n}\r\n\r\ninterface Foo extends Base {\r\n type: 'foo';\r\n foo: string;\r\n}\r\n\r\ninterface Bar extends Base {\r\n type: 'bar';\r\n bar: number;\r\n}\r\n\r\n@Component({\r\n selector: 'app-root',\r\n standalone: true,\r\n template: `\r\n@switch (v.type) {\r\n @case ('bar') {\r\n {{ v.bar }}\r\n }\r\n\r\n @case ('foo') {\r\n {{ v.foo }}\r\n }\r\n\r\n @default {\r\n Default\r\n }\r\n}\r\n `\r\n})\r\nexport class AppComponent {\r\n v: Foo | Bar = { type: 'foo', foo: 'foo' };\r\n}\r\n```\r\n\r\n\u003cimg width=\"580\" alt=\"Screenshot 2023-10-06 at 16 52 13\" src=\"https://github.com/angular/angular/assets/20522870/e5f8f688-38e9-4c6b-afb4-dae8048ab656\">\r\n\r\n\n\n### Please provide a link to a minimal reproduction of the bug\n\n_No response_\n\n### Please provide the exception or error you saw\n\n_No response_\n\n### Please provide the environment you discovered this bug in (run `ng version`)\n\n_No response_\n\n### Anything else?\n\nIt should work similar to typescript code.","author":{"url":"https://github.com/ArielGueta","@type":"Person","name":"ArielGueta"},"datePublished":"2023-10-06T13:55:06Z","url":"https://github.com/angular/angular/issues/52077"}
| 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:ec7f787f-0729-9a02-414e-0657fcaf0b96 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B7AA:26ECEB:144EC3A:19F441B:6B01175B |
| html-safe-nonce | 465f4b7f2fb5a064c9dbf93bcd8310c52750bcafe02e39a02ad4f01e8d1b928e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCN0FBOjI2RUNFQjoxNDRFQzNBOjE5RjQ0MUI6NkIwMTE3NUIiLCJ2aXNpdG9yX2lkIjoiNTI0OTU4NTAyOTg1OTg0MTg4MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2e4a046f7e839fe63aa903b1c20cee309bc82eb3771a9e127b53753e07024262 |
| hovercard-subject-tag | issue:1930233696 |
| 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/52077/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d2c3e77a15cbf3dc99303c78e86fc9cf69e27c0e5d16c16ac081228317e07d2c/angular/angular/issues/52077 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d2c3e77a15cbf3dc99303c78e86fc9cf69e27c0e5d16c16ac081228317e07d2c/angular/angular/issues/52077 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? compiler Is this a regression? No Description interface Base { type: 'foo' | 'bar' } interface Foo extends Base { type: 'foo'; foo: string; } ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ArielGueta |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width