IF
Size: a a a
IF
IF
IF
BB
YS
BB
BB
IF
ВБ
M
A
AO
AO
one(...) и two(...) вызываются по клику внутри темплитаAO
AO
(click)="one($event as A)" ?Вキ
(click)="one($event as A)" ?declare function isA(value: unknown): value is A;
declare function isB(value: unknown): value is B;
const ab = getAB();
if (isA(ab)) {
one(ab);
}
if (isB(ab)) {
two(ab);
}
AS
(click)="one($event as A)" ?AO
declare function isA(value: unknown): value is A;
declare function isB(value: unknown): value is B;
const ab = getAB();
if (isA(ab)) {
one(ab);
}
if (isB(ab)) {
two(ab);
}
(eventFromChildComponent)="one($event)"
templateA.tspublic function one($event: A)
2) templateBhtml`(eventFromChildComponent)="two($event)"
templateB.tspublic function two($event: B)
3) childComponent.ts@Output() public eventFromChild: EventEmitter<(A | B)> = new EventEmitter();AO
AO
(A | B) is not assignable to parameter type B