mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
When the switched expression is nested within a union, exhaustive typechecking needs to know which expression to check.
This change adds the possibility of specifying the expression to check:
```
@Component({
selector: 'app-root',
imports: [],
template: `
@switch (state.mode) {
@case ('show') { {{ state.menu }}; }
@case ('hide') {}
@default never(state);
}
`,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class App {
state!: { mode: 'hide' } | { mode: 'show'; menu: number };;
}
```
fixes #67406
|
||
|---|---|---|
| .. | ||
| linker | ||
| private | ||
| src | ||
| test | ||
| BUILD.bazel | ||
| esbuild.config.js | ||
| index.ts | ||
| package.json | ||
| tsconfig-test.json | ||
| tsconfig.json | ||