-
-
Notifications
You must be signed in to change notification settings - Fork 780
fix(transformer/typescript): namespaces disappeared and do not transform when a type-only namespace followed by a value module namespace #10511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(transformer/typescript): namespaces disappeared and do not transform when a type-only namespace followed by a value module namespace #10511
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Instrumentation Performance ReportMerging #10511 will create unknown performance changesComparing Summary
Benchmarks breakdown
|
Merge activity
|
…orm when a type-only namespace followed by a value module namespace (#10511) Input: ```ts // SymbolFlags: NameSpaceModule export namespace Foo { export type T = 0; } // SymbolFlags: ValueModule export namespace Foo { export const Bar = 1; } ``` Before output: ```js expot {} ``` After Output: ```js // SymbolFlags: ValueModule export let Foo; (function(_Foo) { const Bar = _Foo.Bar = 1; })(Foo || (Foo = {})); ``` When both `NameSpaceModule` and `ValueModule` are present, we need to check the current declaration flags. If the current declaration is `NameSpaceModule`, we can return early because it's a type-only namespace and doesn't emit any JS code, otherwise we need to continue transforming it.
df7d1de to
710a35c
Compare
4f101a1 to
33a2625
Compare

Input:
Before output:
After Output:
When both
NameSpaceModuleandValueModuleare present, we need to check the currentdeclaration flags. If the current declaration is
NameSpaceModule, we can return earlybecause it's a type-only namespace and doesn't emit any JS code, otherwise we need to
continue transforming it.