refactor(transformer/class-properties)!: rename ClassPropertiesOptions::loose (#7716)

`loose` option also covers the `private_fields_as_properties` assumption, not only `set_public_class_fields`.
This commit is contained in:
overlookmotel 2024-12-08 01:41:41 +00:00
parent a6fd2def34
commit 59132006c9

View file

@ -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.
@ -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,