TypeScript/tests/baselines/reference/contextualTypingOfConditionalExpression2.errors.txt

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