2014-07-13 01:04:16 +02:00
|
|
|
//// [typeAssertionToGenericFunctionType.ts]
|
|
|
|
var x = {
|
|
|
|
a: < <T>(x: T) => T > ((x: any) => 1),
|
|
|
|
b: <T>(x: T) => { x }
|
|
|
|
}
|
|
|
|
x.a<string>(1); // bug was that this caused 'Could not find symbol T' on return type T in the type assertion on x.a's definition
|
|
|
|
x.b<string>(); // error
|
|
|
|
|
|
|
|
//// [typeAssertionToGenericFunctionType.js]
|
|
|
|
var x = {
|
2015-03-26 21:46:35 +01:00
|
|
|
a: (function (x) { return 1; }),
|
|
|
|
b: function (x) { x; }
|
2014-07-13 01:04:16 +02:00
|
|
|
};
|
2014-08-16 00:49:09 +02:00
|
|
|
x.a(1); // bug was that this caused 'Could not find symbol T' on return type T in the type assertion on x.a's definition
|
|
|
|
x.b(); // error
|