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