16 lines
229 B
TypeScript
16 lines
229 B
TypeScript
|
interface A {
|
||
|
pred(x: {}, y: {}): x is boolean;
|
||
|
}
|
||
|
interface B {
|
||
|
pred(x: {}, y: {}): y is string;
|
||
|
}
|
||
|
|
||
|
type Or = A | B;
|
||
|
|
||
|
function f(o: Or, x: {}, y: {}) {
|
||
|
if (o.pred(x, y)) {
|
||
|
x;
|
||
|
y;
|
||
|
}
|
||
|
}
|