-
-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(transformer/typescript): retain TSImportEqualsDeclaration in name…
…space when its binding has been referenced or onlyRemoveTypeImports is true
- Loading branch information
Showing
7 changed files
with
144 additions
and
6 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
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
13 changes: 13 additions & 0 deletions
13
...ormance/tests/babel-plugin-transform-typescript/test/fixtures/namespace/import-=/input.ts
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,13 @@ | ||
import A from 'mod'; | ||
namespace N1 { | ||
// Remove because `X` has not been referenced | ||
import X = A.B; | ||
const V = 0; | ||
} | ||
|
||
namespace N2 { | ||
// Retain because `X` has been referenced | ||
import X = A.B; | ||
const V = X; | ||
} | ||
|
11 changes: 11 additions & 0 deletions
11
...rmance/tests/babel-plugin-transform-typescript/test/fixtures/namespace/import-=/output.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,11 @@ | ||
import A from 'mod'; | ||
let N1; | ||
(function (_N) { | ||
const V = 0; | ||
})(N1 || (N1 = {})); | ||
let N2; | ||
(function (_N2) { | ||
// Retain because `X` has been referenced | ||
var X = A.B; | ||
const V = X; | ||
})(N2 || (N2 = {})); |
13 changes: 13 additions & 0 deletions
13
...ests/babel-plugin-transform-typescript/test/fixtures/namespace/preserve-import-=/input.ts
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,13 @@ | ||
import nsa from "mod"; | ||
|
||
namespace N1 { | ||
// Retain because `onlyRemoveTypeImports` is true | ||
import Foo = nsa.bar; | ||
const foo = 0; | ||
} | ||
|
||
namespace N2 { | ||
// Retain because `onlyRemoveTypeImports` is true | ||
import Foo = nsa.bar; | ||
const foo: Foo = 0; | ||
} |
10 changes: 10 additions & 0 deletions
10
.../babel-plugin-transform-typescript/test/fixtures/namespace/preserve-import-=/options.json
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,10 @@ | ||
{ | ||
"plugins": [ | ||
[ | ||
"transform-typescript", | ||
{ | ||
"onlyRemoveTypeImports": true | ||
} | ||
] | ||
] | ||
} |
15 changes: 15 additions & 0 deletions
15
...sts/babel-plugin-transform-typescript/test/fixtures/namespace/preserve-import-=/output.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,15 @@ | ||
import nsa from "mod"; | ||
|
||
let N1; | ||
(function(_N) { | ||
// Retain because `onlyRemoveTypeImports` is true | ||
var Foo = nsa.bar; | ||
const foo = 0; | ||
})(N1 || (N1 = {})); | ||
|
||
let N2; | ||
(function(_N2) { | ||
// Retain because `onlyRemoveTypeImports` is true | ||
var Foo = nsa.bar; | ||
const foo = 0; | ||
})(N2 || (N2 = {})); |