From bbf9ec0774bb92ad061330047474187b6e3bac09 Mon Sep 17 00:00:00 2001 From: Boshen <1430279+Boshen@users.noreply.github.com> Date: Sat, 17 Aug 2024 14:26:24 +0000 Subject: [PATCH] fix(codegen): add missing `declare` to `PropertyDefinition` (#4937) I'm seeing a broken test for ```rust #[test] fn dts_class_decl_prop_test() { transform_dts_test( "export class Foo { declare a: string }", "export declare class Foo { a: string; }", ); } ``` can you double check @Dunqing ? --- crates/oxc_codegen/src/gen.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/oxc_codegen/src/gen.rs b/crates/oxc_codegen/src/gen.rs index fb4ff8e08d4df..65c7c2b5a6d21 100644 --- a/crates/oxc_codegen/src/gen.rs +++ b/crates/oxc_codegen/src/gen.rs @@ -2535,6 +2535,9 @@ impl<'a, const MINIFY: bool> Gen for PropertyDefinition<'a> { fn gen(&self, p: &mut Codegen<{ MINIFY }>, ctx: Context) { p.add_source_mapping(self.span.start); self.decorators.gen(p, ctx); + if self.declare { + p.print_str("declare "); + } if let Some(accessibility) = &self.accessibility { accessibility.gen(p, ctx); }