diff --git a/crates/oxc_codegen/src/gen.rs b/crates/oxc_codegen/src/gen.rs index 46407137199d2..bcba66b9e3e16 100644 --- a/crates/oxc_codegen/src/gen.rs +++ b/crates/oxc_codegen/src/gen.rs @@ -3935,6 +3935,9 @@ impl Gen for TSConstructorType<'_> { impl Gen for TSImportEqualsDeclaration<'_> { fn r#gen(&self, p: &mut Codegen, ctx: Context) { p.print_str("import "); + if self.import_kind.is_type() { + p.print_str("type "); + } self.id.print(p, ctx); p.print_soft_space(); p.print_ascii_byte(b'='); diff --git a/crates/oxc_codegen/tests/integration/ts.rs b/crates/oxc_codegen/tests/integration/ts.rs index dd45337872cf2..1d2dfa4219c4c 100644 --- a/crates/oxc_codegen/tests/integration/ts.rs +++ b/crates/oxc_codegen/tests/integration/ts.rs @@ -42,6 +42,7 @@ fn cases() { test_same("class F {\n\taccessor value!: string;\n}\n"); test_same("class E {\n\tstatic [key: string]: string;\n}\n"); test_same("export { type as as };\n"); + test_same("import type from = require(\"./a\");\n"); test_same("try {} catch (e: unknown) {} finally {}\n"); }