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

22 lines
920 B
Plaintext
Raw Normal View History

2014-11-05 21:26:03 +01:00
tests/cases/compiler/overEagerReturnTypeSpecialization.ts(8,5): error TS2322: Type 'I1<number>' is not assignable to type 'I1<string>'.
Type 'number' is not assignable to type 'string'.
2014-07-13 01:04:16 +02:00
==== tests/cases/compiler/overEagerReturnTypeSpecialization.ts (1 errors) ====
//Note: Below simpler repro
interface I1<T> {
func<U>(callback: (value: T) => U): I1<U>;
}
declare var v1: I1<number>;
var r1: I1<string> = v1.func(num => num.toString()) // Correctly returns an I1<string>
~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'I1<number>' is not assignable to type 'I1<string>'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
.func(str => str.length); // should error
2014-07-13 01:04:16 +02:00
var r2: I1<number> = v1.func(num => num.toString()) // Correctly returns an I1<string>
.func(str => str.length); // should be ok