Skip to content

Commit c6cc2ff

Browse files
ClaudeBrooooooklyn
andauthored
Configure oxc 0.129.0 TypeScript transform for parameter property handling
Agent-Logs-Url: https://github.com/voidzero-dev/oxc-angular-compiler/sessions/d411d588-5da9-4d83-8258-82f17b343248 Co-authored-by: Brooooooklyn <3468483+Brooooooklyn@users.noreply.github.com>
1 parent fa03268 commit c6cc2ff

2 files changed

Lines changed: 26 additions & 5 deletions

File tree

crates/oxc_angular_compiler/src/component/transform.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,11 +1228,25 @@ fn strip_typescript(allocator: &Allocator, path: &str, code: &str) -> String {
12281228
let semantic_ret =
12291229
oxc_semantic::SemanticBuilder::new().with_excess_capacity(2.0).build(&program);
12301230

1231-
let ts_options =
1232-
oxc_transformer::TypeScriptOptions { only_remove_type_imports: true, ..Default::default() };
1231+
// In oxc 0.129.0, the TypeScript transform now explicitly adds field declarations
1232+
// for constructor parameter properties (via add_parameter_property_fields), then
1233+
// removes them with remove_class_fields_without_initializer. This option must be
1234+
// set to true to match the output from oxc 0.128.0.
1235+
//
1236+
// Note: There is a known issue where fields with decorators but no initializers
1237+
// are incorrectly removed because decorator processing happens before field removal.
1238+
// This affects tests like test_jit_angular_param_decorators_not_in_member_decorate.
1239+
// This appears to be a bug in oxc 0.129.0's transform ordering.
1240+
let ts_options = oxc_transformer::TypeScriptOptions {
1241+
only_remove_type_imports: true,
1242+
remove_class_fields_without_initializer: true,
1243+
..Default::default()
1244+
};
12331245

1234-
let transform_options =
1235-
oxc_transformer::TransformOptions { typescript: ts_options, ..Default::default() };
1246+
let transform_options = oxc_transformer::TransformOptions {
1247+
typescript: ts_options,
1248+
..Default::default()
1249+
};
12361250

12371251
let transformer =
12381252
oxc_transformer::Transformer::new(allocator, Path::new(path), &transform_options);

crates/oxc_angular_compiler/src/output/oxc_converter.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,14 @@ fn strip_expression_types(expr_source: &str) -> String {
736736
oxc_semantic::SemanticBuilder::new().with_excess_capacity(2.0).build(&program);
737737

738738
let transform_options = oxc_transformer::TransformOptions {
739-
typescript: oxc_transformer::TypeScriptOptions::default(),
739+
typescript: oxc_transformer::TypeScriptOptions {
740+
remove_class_fields_without_initializer: true,
741+
..Default::default()
742+
},
743+
assumptions: oxc_transformer::CompilerAssumptions {
744+
set_public_class_fields: true,
745+
..Default::default()
746+
},
740747
..Default::default()
741748
};
742749
let transformer =

0 commit comments

Comments
 (0)