26 lines
No EOL
1.1 KiB
Text
26 lines
No EOL
1.1 KiB
Text
tests/cases/compiler/contextualTypingOfConditionalExpression2.ts(11,5): error TS2322: Type '((a: C) => number) | ((b: number) => void)' is not assignable to type '(a: A) => void'.
|
|
Type '(b: number) => void' is not assignable to type '(a: A) => void'.
|
|
Types of parameters 'b' and 'a' are incompatible.
|
|
Type 'number' is not assignable to type 'A'.
|
|
Property 'foo' is missing in type 'Number'.
|
|
|
|
|
|
==== tests/cases/compiler/contextualTypingOfConditionalExpression2.ts (1 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 TS2322: Type '((a: C) => number) | ((b: number) => void)' is not assignable to type '(a: A) => void'.
|
|
!!! error TS2322: Type '(b: number) => void' is not assignable to type '(a: A) => void'.
|
|
!!! error TS2322: Types of parameters 'b' and 'a' are incompatible.
|
|
!!! error TS2322: Type 'number' is not assignable to type 'A'.
|
|
!!! error TS2322: Property 'foo' is missing in type 'Number'.
|
|
|