diff --git a/crates/oxc_codegen/src/gen.rs b/crates/oxc_codegen/src/gen.rs index d28ee441b3..de73c6fef1 100644 --- a/crates/oxc_codegen/src/gen.rs +++ b/crates/oxc_codegen/src/gen.rs @@ -2780,6 +2780,9 @@ impl Gen for PropertyDefinition<'_> { if self.optional { p.print_ascii_byte(b'?'); } + if self.definite { + p.print_ascii_byte(b'!'); + } if let Some(type_annotation) = &self.type_annotation { p.print_colon(); p.print_soft_space(); diff --git a/crates/oxc_codegen/tests/integration/ts.rs b/crates/oxc_codegen/tests/integration/ts.rs index 9dfd7243ec..d2370bf983 100644 --- a/crates/oxc_codegen/tests/integration/ts.rs +++ b/crates/oxc_codegen/tests/integration/ts.rs @@ -31,6 +31,7 @@ fn cases() { test_same("class B {\n\tconstructor(override readonly a: number) {}\n}\n"); test_same("class C extends B {\n\toverride show(): void;\n\toverride hide(): void;\n}\n"); test_same("class D extends B {\n\toverride readonly x: number;\n}\n"); + test_same("class E {\n\tsubscribe!: string;\n}\n"); test_same("export { type as as };\n"); }