diff --git a/crates/oxc_codegen/src/gen.rs b/crates/oxc_codegen/src/gen.rs index 9672ad0769a80..0dcc8a590a44d 100644 --- a/crates/oxc_codegen/src/gen.rs +++ b/crates/oxc_codegen/src/gen.rs @@ -2994,6 +2994,9 @@ impl<'a, const MINIFY: bool> Gen for TSLiteral<'a> { impl<'a, const MINIFY: bool> Gen for TSTypeParameter<'a> { fn gen(&self, p: &mut Codegen<{ MINIFY }>, ctx: Context) { + if self.r#const { + p.print_str(b"const "); + } self.name.gen(p, ctx); if let Some(constraint) = &self.constraint { p.print_str(b" extends "); diff --git a/crates/oxc_codegen/tests/mod.rs b/crates/oxc_codegen/tests/mod.rs index c6df2b62c59c6..f834ac8e8d22d 100644 --- a/crates/oxc_codegen/tests/mod.rs +++ b/crates/oxc_codegen/tests/mod.rs @@ -200,6 +200,7 @@ fn typescript() { false, ); test_ts("let foo: { (t: T): void }", "let foo: {(t: T): void};\n", false); + test_ts("function (){}", "function() {}\n", false); } fn test_comment_helper(source_text: &str, expected: &str) {