-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es/typescript): Handle single type statement in if/for/while (#9364)
- Closes: #9363
- Loading branch information
1 parent
9fba319
commit 2217730
Showing
6 changed files
with
146 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
swc_ecma_transforms_typescript: patch | ||
swc_fast_ts_strip: patch | ||
--- | ||
|
||
Fix (TypeScript): Handle single type statement in if/for/while |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
if (false) ; | ||
console.log("Hello, World!"); | ||
|
||
if (false) { } | ||
else ; | ||
console.log("Hello, World!"); | ||
|
||
for (; false;) | ||
; | ||
console.log("Hello, World!"); | ||
|
||
for (; false;) | ||
; | ||
console.log("Hello, World!"); | ||
|
||
while (false) | ||
; | ||
console.log("Hello, World!"); | ||
|
||
do | ||
; | ||
while (false); |
12 changes: 12 additions & 0 deletions
12
crates/swc_fast_ts_strip/tests/fixture/single-ts-stmt.transform.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
if (false) ; | ||
console.log("Hello, World!"); | ||
if (false) {} else ; | ||
console.log("Hello, World!"); | ||
for(; false;); | ||
console.log("Hello, World!"); | ||
for(; false;); | ||
console.log("Hello, World!"); | ||
while(false); | ||
console.log("Hello, World!"); | ||
do ; | ||
while (false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
if (false) type Foo = string | ||
console.log("Hello, World!"); | ||
|
||
if (false) { } | ||
else type Bar = string | ||
console.log("Hello, World!"); | ||
|
||
for (; false;) | ||
interface X { } | ||
console.log("Hello, World!"); | ||
|
||
for (; false;) | ||
interface X { } | ||
console.log("Hello, World!"); | ||
|
||
while (false) | ||
type Baz = string | ||
console.log("Hello, World!"); | ||
|
||
do | ||
interface X { } | ||
while (false); |