fix(codegen): print type annotation on CatchParameter (#19790)

This commit is contained in:
camc314 committed 2026-02-27 08:28:13 +00:00
1 parent 297b2bbe10
commit 9e4995cd3d
2 files changed
+6

No files matched your search

+5
View File
@@ -604,6 +604,11 @@ impl Gen for CatchClause<'_> {
p.print_soft_space();
p.print_ascii_byte(b'(');
param.pattern.print(p, ctx);
if let Some(type_annotation) = &param.type_annotation {
p.print_colon();
p.print_soft_space();
type_annotation.print(p, ctx);
}
p.print_ascii_byte(b')');
}
p.print_soft_space();
@@ -36,6 +36,7 @@ fn cases() {
test_same("class E {\n\tsubscribe!: string;\n}\n");
test_same("class F {\n\taccessor value!: string;\n}\n");
test_same("export { type as as };\n");
test_same("try {} catch (e: unknown) {} finally {}\n");
}
#[test]