mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
24 lines
1008 B
Plaintext
24 lines
1008 B
Plaintext
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 'A' is not assignable to type 'number'.
|
|
|
|
|
|
==== 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 'A' is not assignable to type 'number'.
|
|
|