2014-07-13 01:04:16 +02:00
|
|
|
//// [overEagerReturnTypeSpecialization.ts]
|
|
|
|
//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>
|
|
|
|
.func(str => str.length); // should error
|
|
|
|
|
|
|
|
var r2: I1<number> = v1.func(num => num.toString()) // Correctly returns an I1<string>
|
|
|
|
.func(str => str.length); // should be ok
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//// [overEagerReturnTypeSpecialization.js]
|
2014-08-19 19:43:13 +02:00
|
|
|
//Note: Below simpler repro
|
2015-01-23 00:58:00 +01:00
|
|
|
var r1 = v1.func(function (num) { return num.toString(); }) // Correctly returns an I1<string>
|
|
|
|
.func(function (str) { return str.length; }); // should error
|
|
|
|
var r2 = v1.func(function (num) { return num.toString(); }) // Correctly returns an I1<string>
|
|
|
|
.func(function (str) { return str.length; }); // should be ok
|