From 46fb3cbb3eb11a1c8766220198d35e9710b10923 Mon Sep 17 00:00:00 2001 From: Dunqing <29533304+Dunqing@users.noreply.github.com> Date: Thu, 15 Aug 2024 14:48:28 +0000 Subject: [PATCH] Revert "fix(isolated_declarations): Always emit module declarations (#4911)" (#4916) This reverts commit 0fb0b71f0d2615c39e7d7bcee764915aa76ce2d0. test failed https://github.com/oxc-project/oxc/actions/runs/10405198969/job/28815418191 We should only emit for ```ts declare module "xx" {} declare global {} ``` Do not emit for ```ts module x {} declare module x {} ``` @MichaelMitchell-at cc --- crates/oxc_isolated_declarations/src/lib.rs | 3 --- .../tests/fixtures/module-declaration.ts | 5 ----- .../tests/snapshots/module-declaration.snap | 12 ------------ 3 files changed, 20 deletions(-) delete mode 100644 crates/oxc_isolated_declarations/tests/fixtures/module-declaration.ts delete mode 100644 crates/oxc_isolated_declarations/tests/snapshots/module-declaration.snap diff --git a/crates/oxc_isolated_declarations/src/lib.rs b/crates/oxc_isolated_declarations/src/lib.rs index 28b2f25f1034b..c6ce198479cda 100644 --- a/crates/oxc_isolated_declarations/src/lib.rs +++ b/crates/oxc_isolated_declarations/src/lib.rs @@ -314,9 +314,6 @@ impl<'a> IsolatedDeclarations<'a> { new_ast_stmts.push(Statement::ImportDeclaration(decl)); } } - Statement::TSModuleDeclaration(decl) => { - new_ast_stmts.push(Statement::TSModuleDeclaration(decl)); - } _ => {} } } diff --git a/crates/oxc_isolated_declarations/tests/fixtures/module-declaration.ts b/crates/oxc_isolated_declarations/tests/fixtures/module-declaration.ts deleted file mode 100644 index ce062696a1910..0000000000000 --- a/crates/oxc_isolated_declarations/tests/fixtures/module-declaration.ts +++ /dev/null @@ -1,5 +0,0 @@ -import 'foo'; -declare module 'foo' { - interface Foo {} - const foo = 42; -} \ No newline at end of file diff --git a/crates/oxc_isolated_declarations/tests/snapshots/module-declaration.snap b/crates/oxc_isolated_declarations/tests/snapshots/module-declaration.snap deleted file mode 100644 index 05c4731dfdb18..0000000000000 --- a/crates/oxc_isolated_declarations/tests/snapshots/module-declaration.snap +++ /dev/null @@ -1,12 +0,0 @@ ---- -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 {};