17 lines
No EOL
574 B
Text
17 lines
No EOL
574 B
Text
==== 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) => { };
|
|
~~
|
|
!!! 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'.
|
|
|