-
-
Notifications
You must be signed in to change notification settings - Fork 477
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): Always emit module declarations that perf…
…orm augmentation
- Loading branch information
MichaelMitchell-at
committed
Aug 15, 2024
1 parent
9c700ed
commit f0ebcb1
Showing
3 changed files
with
41 additions
and
0 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
21 changes: 21 additions & 0 deletions
21
crates/oxc_isolated_declarations/tests/fixtures/module-declaration.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,21 @@ | ||
import 'foo'; | ||
declare module 'foo' { | ||
interface Foo {} | ||
const foo = 42; | ||
} | ||
|
||
declare global { | ||
interface Bar {} | ||
const bar = 42 ; | ||
} | ||
|
||
// should not be emitted | ||
module baz { | ||
interface Baz {} | ||
const baz = 42; | ||
} | ||
|
||
declare module x { | ||
interface Qux {} | ||
const qux = 42; | ||
} |
15 changes: 15 additions & 0 deletions
15
crates/oxc_isolated_declarations/tests/snapshots/module-declaration.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,15 @@ | ||
--- | ||
source: crates/oxc_isolated_declarations/tests/mod.rs | ||
input_file: crates/oxc_isolated_declarations/tests/fixtures/module-declaration.ts | ||
--- | ||
==================== .D.TS ==================== | ||
|
||
import "foo"; | ||
declare module "foo" { | ||
interface Foo {} | ||
const foo = 42; | ||
} | ||
declare global { | ||
interface Bar {} | ||
const bar = 42; | ||
} |