aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/transpiler.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/bun.js/transpiler.test.js')
-rw-r--r--test/bun.js/transpiler.test.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/bun.js/transpiler.test.js b/test/bun.js/transpiler.test.js
index dcc7f397a..a51b49235 100644
--- a/test/bun.js/transpiler.test.js
+++ b/test/bun.js/transpiler.test.js
@@ -80,6 +80,57 @@ describe("Bun.Transpiler", () => {
);
});
+ it("class constructor", () => {
+ const fixtures = [
+ [
+ `class Test {
+ b: string;
+
+ constructor(private a: string) {
+ this.b = a;
+ }
+ }`,
+
+ `
+class Test {
+ a;
+ b;
+ constructor(a) {
+ this.b = a;
+ this.a = a;
+ }
+}
+ `.trim(),
+ ],
+ [
+ `class Test extends Bar {
+ b: string;
+
+ constructor(private a: string) {
+ super();
+ this.b = a;
+ }
+ }`,
+
+ `
+class Test extends Bar {
+ a;
+ b;
+ constructor(a) {
+ super();
+ this.b = a;
+ this.a = a;
+ }
+}
+ `.trim(),
+ ],
+ ];
+
+ for (const [code, out] of fixtures) {
+ expect(ts.parsed(code, false, false).trim()).toBe(out);
+ }
+ });
+
it("import Foo = require('bar')", () => {
ts.expectPrinted_(
"import React = require('react')",