diff --git a/test-app/app/src/main/assets/app/tests/testsForTypescript.js b/test-app/app/src/main/assets/app/tests/testsForTypescript.js index ae80690ec..34b586d5b 100644 --- a/test-app/app/src/main/assets/app/tests/testsForTypescript.js +++ b/test-app/app/src/main/assets/app/tests/testsForTypescript.js @@ -235,6 +235,27 @@ describe("Tests typescript", function () { expect(isInstanceOf).toEqual(true); }); + it("When_a_typescript_class_without_a_constructor_is_created_with_arguments_it_should_pass_them_to_the_java_constructor", function () { + + // TypeScript's output for `class NamedThread extends java.lang.Thread {}`. + var NamedThread = (function (_super) { + __extends(NamedThread, _super); + function NamedThread() { + return _super !== null && _super.apply(this, arguments) || this; + } + NamedThread.prototype.run = function () { + }; + return NamedThread; + })(java.lang.Thread); + + var thread = new NamedThread("named"); + expect(thread instanceof NamedThread).toBe(true); + expect(thread.getName()).toBe("named"); + + var unnamed = new NamedThread(); + expect(unnamed instanceof NamedThread).toBe(true); + }); + it("When_creating_a_typescript_instance_it_should_support_member_access", function () { __log("TEST: When_creating_a_typescript_instance_it_should_support_member_access"); diff --git a/test-app/app/src/main/assets/internal/ts_helpers.js b/test-app/app/src/main/assets/internal/ts_helpers.js index d1860dc47..5f187f94c 100644 --- a/test-app/app/src/main/assets/internal/ts_helpers.js +++ b/test-app/app/src/main/assets/internal/ts_helpers.js @@ -91,7 +91,7 @@ var Extended = extend(thiz); thiz.__container__ = true; if (args && args.length > 0) { - thiz.__proto__ = new (Function.prototype.bind.apply(Extended, [null].concat(args))); + thiz.__proto__ = new (Function.prototype.bind.apply(Extended, [null].concat(Array.prototype.slice.call(args)))); } else { thiz.__proto__ = new Extended();