-
-
Notifications
You must be signed in to change notification settings - Fork 501
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(isolated-declarations): handle
export
in the namespace
corre…
…ctly (#5950) Previous I didn't follow the behavior of `TypeScript` to handle `export` in `namespace` as I thought no one used this
- Loading branch information
Showing
8 changed files
with
128 additions
and
13 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
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
36 changes: 36 additions & 0 deletions
36
crates/oxc_isolated_declarations/tests/fixtures/module-declaration-with-export.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,36 @@ | ||
export namespace OnlyOneExport { | ||
export const a = 0; | ||
} | ||
|
||
|
||
export namespace TwoExports { | ||
export const c = 0; | ||
export const a: typeof c = 0; | ||
} | ||
|
||
|
||
export namespace OneExportReferencedANonExported { | ||
const c = 0; | ||
export const a: typeof c = c; | ||
} | ||
|
||
declare module "OnlyOneExport" { | ||
export const a = 0; | ||
} | ||
|
||
|
||
declare module "TwoExports" { | ||
export const c = 0; | ||
export const a: typeof c; | ||
} | ||
|
||
|
||
declare module "OneExportReferencedANonExported" { | ||
const c = 0; | ||
export const a: typeof c; | ||
} | ||
|
||
declare global { | ||
const c = 0; | ||
export const a: typeof c; | ||
} |
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
34 changes: 34 additions & 0 deletions
34
crates/oxc_isolated_declarations/tests/snapshots/module-declaration-with-export.snap
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,34 @@ | ||
--- | ||
source: crates/oxc_isolated_declarations/tests/mod.rs | ||
input_file: crates/oxc_isolated_declarations/tests/fixtures/module-declaration-with-export.ts | ||
--- | ||
``` | ||
==================== .D.TS ==================== | ||
export declare namespace OnlyOneExport { | ||
const a = 0; | ||
} | ||
export declare namespace TwoExports { | ||
const c = 0; | ||
const a: typeof c; | ||
} | ||
export declare namespace OneExportReferencedANonExported { | ||
const c = 0; | ||
export const a: typeof c; | ||
export {}; | ||
} | ||
declare module "OnlyOneExport" { | ||
const a = 0; | ||
} | ||
declare module "TwoExports" { | ||
const c = 0; | ||
const a: typeof c; | ||
} | ||
declare module "OneExportReferencedANonExported" { | ||
const c = 0; | ||
const a: typeof c; | ||
} | ||
declare global { | ||
const c = 0; | ||
export const a: typeof c; | ||
} |
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