-
-
Notifications
You must be signed in to change notification settings - Fork 502
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(isolated-declarations): retain
declare
declarations when they a…
- Loading branch information
Showing
6 changed files
with
74 additions
and
50 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
15 changes: 15 additions & 0 deletions
15
crates/oxc_isolated_declarations/tests/fixtures/export-declare-declarations.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,15 @@ | ||
import { Reference, Unreferenced } from 'mod'; | ||
|
||
declare class Class {} | ||
declare function Function(): Reference | ||
declare const variable: number; | ||
declare enum Enum { A, B, C } | ||
|
||
// Should not be included in the output, because they are not exported | ||
declare class UnreferencedClass {} | ||
declare function UnreferencedFunction(): Unreferenced | ||
declare const UnreferencedVariable: number; | ||
declare enum UnreferencedEnum { A, B, C } | ||
|
||
|
||
export { Class, Function, variable, Enum } |
17 changes: 17 additions & 0 deletions
17
crates/oxc_isolated_declarations/tests/snapshots/export-declare-declarations.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,17 @@ | ||
--- | ||
source: crates/oxc_isolated_declarations/tests/mod.rs | ||
input_file: crates/oxc_isolated_declarations/tests/fixtures/export-declare-declarations.ts | ||
--- | ||
``` | ||
==================== .D.TS ==================== | ||
import { Reference } from "mod"; | ||
declare class Class {} | ||
declare function Function(): Reference; | ||
declare const variable: number; | ||
declare enum Enum { | ||
A = 0, | ||
B = 1, | ||
C = 2, | ||
} | ||
export { Class, Function, variable, Enum }; |