Skip to content

Commit

Permalink
refactor(transformer/class-properties)!: rename `ClassPropertiesOptio…
Browse files Browse the repository at this point in the history
…ns::loose` (#7716)

`loose` option also covers the `private_fields_as_properties` assumption, not only `set_public_class_fields`.
  • Loading branch information
overlookmotel committed Dec 8, 2024
1 parent a6fd2de commit 5913200
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions crates/oxc_transformer/src/es2022/class_properties/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ type FxIndexMap<K, V> = IndexMap<K, V, FxBuildHasher>;
#[derive(Debug, Default, Clone, Copy, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ClassPropertiesOptions {
#[serde(alias = "loose")]
pub(crate) set_public_class_fields: bool,
pub(crate) loose: bool,
}

/// Class properties transform.
Expand Down Expand Up @@ -227,8 +226,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
ctx: &'ctx TransformCtx<'a>,
) -> Self {
// TODO: Raise error if these 2 options are inconsistent
let set_public_class_fields =
options.set_public_class_fields || ctx.assumptions.set_public_class_fields;
let set_public_class_fields = options.loose || ctx.assumptions.set_public_class_fields;

Self {
set_public_class_fields,
Expand Down

0 comments on commit 5913200

Please sign in to comment.