Closed
Description
Bug Report
π Search Terms
Parameter properties
Private fields
Class constructor
Destructuring assignment
π Version & Regression Information
- This changed between versions
4.5.5
and4.6.2
- Working in
4.6.0-dev.20220113
- Broken in
4.6.0-dev.20220114
,4.6.0-beta
and later (still broken on nightly)
I think this means the breaking change was made in #29374.
β― Playground Link
π» Code
export default class ClassMissingField {
readonly #privateField: string;
constructor(
arg: { key: string },
public exposedField: number
) {
({ key: this.#privateField } = arg);
}
log() {
console.log(this.#privateField);
console.log(this.exposedField);
}
}
π Actual behavior
exposedField
not set as a property on ClassMissingField
, even though it should be via the parameter property. This is the minimal example I could find - it seems to need a private field with a destructuring assignment.
π Expected behavior
exposedField
should be set as a property on ClassMissingField
using parameter properties.