2014-07-13 01:04:16 +02:00
|
|
|
==== 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) => { };
|
2014-07-19 02:30:06 +02:00
|
|
|
~~
|
2014-07-13 01:04:16 +02:00
|
|
|
!!! Type '{}' is not assignable to type '(a: A) => void'.
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
!!! No best common type exists between '(a: A) => void', '(a: C) => number', and '(b: number) => void'.
|
|
|
|
|