TypeScript/tests/baselines/reference/contextualTypingOfConditionalExpression2.errors.txt
2014-09-11 16:11:08 -07:00

17 lines
602 B
Plaintext

==== tests/cases/compiler/contextualTypingOfConditionalExpression2.ts (2 errors) ====
class A {
foo: number;
}
class B extends A {
bar: number;
}
class C extends A {
baz: number;
}
var x2: (a: A) => void = true ? (a: C) => a.foo : (b: number) => { };
~~
!!! error TS2323: Type '{}' is not assignable to type '(a: A) => void'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2366: No best common type exists between '(a: A) => void', '(a: C) => number', and '(b: number) => void'.