mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
fix(isolated_declarations): Always emit module declarations (#4911)
Fixes https://github.com/oxc-project/oxc/issues/4607 Co-authored-by: MichaelMitchell-at <=>
This commit is contained in:
parent
4a16916887
commit
0fb0b71f0d
3 changed files with 20 additions and 0 deletions
|
|
@ -314,6 +314,9 @@ impl<'a> IsolatedDeclarations<'a> {
|
|||
new_ast_stmts.push(Statement::ImportDeclaration(decl));
|
||||
}
|
||||
}
|
||||
Statement::TSModuleDeclaration(decl) => {
|
||||
new_ast_stmts.push(Statement::TSModuleDeclaration(decl));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
5
crates/oxc_isolated_declarations/tests/fixtures/module-declaration.ts
vendored
Normal file
5
crates/oxc_isolated_declarations/tests/fixtures/module-declaration.ts
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import 'foo';
|
||||
declare module 'foo' {
|
||||
interface Foo {}
|
||||
const foo = 42;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
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;
|
||||
}
|
||||
export {};
|
||||
Loading…
Reference in a new issue