-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Closed
Labels
area: compilerIssues related to `ngc`, Angular's template compilerIssues related to `ngc`, Angular's template compilercompiler: template type-checkingstate: has PR
Milestone
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: compilerIssues related to `ngc`, Angular's template compilerIssues related to `ngc`, Angular's template compilercompiler: template type-checkingstate: has PR