2014-07-13 01:04:16 +02:00
|
|
|
//// [wrappedAndRecursiveConstraints3.ts]
|
|
|
|
// no errors expected
|
|
|
|
|
|
|
|
class C<T extends { length: number }> {
|
|
|
|
constructor(x: T) { }
|
|
|
|
foo<U extends T>(x: U) {
|
|
|
|
function bar<V extends U>(x: V) {
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
return bar;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var c = new C({ length: 2 });
|
|
|
|
var r = c.foo({ length: 3, charAt: (x: number) => { '' } });
|
|
|
|
var r2 = r('');
|
|
|
|
|
|
|
|
//// [wrappedAndRecursiveConstraints3.js]
|
2014-08-14 15:42:18 +02:00
|
|
|
// no errors expected
|
2014-07-13 01:04:16 +02:00
|
|
|
var C = (function () {
|
|
|
|
function C(x) {
|
|
|
|
}
|
|
|
|
C.prototype.foo = function (x) {
|
|
|
|
function bar(x) {
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
return bar;
|
|
|
|
};
|
|
|
|
return C;
|
|
|
|
})();
|
|
|
|
var c = new C({ length: 2 });
|
|
|
|
var r = c.foo({ length: 3, charAt: function (x) {
|
2015-02-22 00:11:37 +01:00
|
|
|
'';
|
|
|
|
} });
|
2014-07-13 01:04:16 +02:00
|
|
|
var r2 = r('');
|