TypeScript/tests/baselines/reference/primitiveConstraints2.js
2014-07-12 17:30:19 -07:00

24 lines
447 B
JavaScript

//// [primitiveConstraints2.ts]
class C<T> {
public bar2<U extends T>(x: T, y: U): T {
return null;
}
}
var x = new C<number>();
x.bar2(2, ""); // should error
x.bar2<string>(2, ""); // should error
//// [primitiveConstraints2.js]
var C = (function () {
function C() {
}
C.prototype.bar2 = function (x, y) {
return null;
};
return C;
})();
var x = new C();
x.bar2(2, "");
x.bar2(2, "");