Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ts] Fix transform for nested namespaces shorthand syntax (#13664)
- Loading branch information
1 parent
64d116b
commit 1355d00
Showing
7 changed files
with
81 additions
and
3 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
3 changes: 3 additions & 0 deletions
3
...ugin-transform-typescript/test/fixtures/namespace/ambient-module-nested-exported/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,3 @@ | ||
namespace X { | ||
export module "m" {} | ||
} |
3 changes: 3 additions & 0 deletions
3
...-transform-typescript/test/fixtures/namespace/ambient-module-nested-exported/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,3 @@ | ||
{ | ||
"throws": "Ambient modules cannot be nested in other modules or namespaces." | ||
} |
3 changes: 3 additions & 0 deletions
3
.../babel-plugin-transform-typescript/test/fixtures/namespace/ambient-module-nested/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,3 @@ | ||
namespace X { | ||
module "m" {} | ||
} |
3 changes: 3 additions & 0 deletions
3
...el-plugin-transform-typescript/test/fixtures/namespace/ambient-module-nested/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,3 @@ | ||
{ | ||
"throws": "Ambient modules cannot be nested in other modules or namespaces." | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/babel-plugin-transform-typescript/test/fixtures/namespace/nested-shorthand/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,7 @@ | ||
namespace X.Y { | ||
export const Z = 1; | ||
} | ||
|
||
namespace proj.data.util.api { | ||
export const X = 1; | ||
} |
27 changes: 27 additions & 0 deletions
27
...ges/babel-plugin-transform-typescript/test/fixtures/namespace/nested-shorthand/output.mjs
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,27 @@ | ||
let X; | ||
|
||
(function (_X) { | ||
let Y; | ||
|
||
(function (_Y) { | ||
const Z = _Y.Z = 1; | ||
})(Y || (Y = _X.Y || (_X.Y = {}))); | ||
})(X || (X = {})); | ||
|
||
let proj; | ||
|
||
(function (_proj) { | ||
let data; | ||
|
||
(function (_data) { | ||
let util; | ||
|
||
(function (_util) { | ||
let api; | ||
|
||
(function (_api) { | ||
const X = _api.X = 1; | ||
})(api || (api = _util.api || (_util.api = {}))); | ||
})(util || (util = _data.util || (_data.util = {}))); | ||
})(data || (data = _proj.data || (_proj.data = {}))); | ||
})(proj || (proj = {})); |