Closed
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';
bar: number;
}
@Component({
selector: 'app-root',
standalone: true,
template: `
@switch (v.type) {
@case ('bar') {
{{ v.bar }}
}
@case ('foo') {
{{ v.foo }}
}
@default {
Default
}
}
`
})
export class AppComponent {
v: Foo | Bar = { type: 'foo', foo: 'foo' };
}

Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run ng version
)
No response
Anything else?
It should work similar to typescript code.