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

26 lines
1.1 KiB
Plaintext
Raw Normal View History

2014-11-05 21:26:03 +01:00
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) ====
2014-07-13 01:04:16 +02:00
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-11-05 21:26:03 +01:00
!!! 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'.
2014-07-13 01:04:16 +02:00