TypeScript/tests/baselines/reference/heterogeneousArrayAndOverloads.js

27 lines
664 B
TypeScript
Raw Normal View History

2014-07-13 01:04:16 +02:00
//// [heterogeneousArrayAndOverloads.ts]
class arrTest {
test(arg1: number[]);
test(arg1: string[]);
test(arg1: any[]) { }
callTest() {
this.test([1, 2, 3, 5]);
this.test(["hi"]);
this.test([]);
this.test([1, 2, "hi", 5]); // Error
}
}
//// [heterogeneousArrayAndOverloads.js]
var arrTest = (function () {
function arrTest() {
}
arrTest.prototype.test = function (arg1) { };
2014-07-13 01:04:16 +02:00
arrTest.prototype.callTest = function () {
this.test([1, 2, 3, 5]);
this.test(["hi"]);
2014-07-13 01:04:16 +02:00
this.test([]);
this.test([1, 2, "hi", 5]); // Error
2014-07-13 01:04:16 +02:00
};
return arrTest;
})();