aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/transpiler.test.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-20 00:06:27 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-20 00:06:27 -0800
commit3a100af876836fcdbe9b36da0642289284cd6a1b (patch)
tree166c1efa64a89046b00479d426be40bd299fa347 /test/bun.js/transpiler.test.js
parent7d7b5350147e16bee0c173eef995b6abe6250932 (diff)
downloadbun-3a100af876836fcdbe9b36da0642289284cd6a1b.tar.gz
bun-3a100af876836fcdbe9b36da0642289284cd6a1b.tar.zst
bun-3a100af876836fcdbe9b36da0642289284cd6a1b.zip
Fixes #1855
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')",