You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(cli): replace getters and setters with a public field (#215)
The `CliIoHost` had a number of fields that had the following pattern:
```ts
class CliIoHost {
private _someField: string;
/** Get someField */
public get someField() {
return this._someField;
}
/** Set someField */
public set someField(value: string) {
this._someField = value;
}
}
```
There is no additional code in the getters and setters other than
directly forwarding every access to a private field, so the above is
equivalent to the following:
```ts
class CliIoHost {
public someField: string;
}
```
Since the above is simpler, this PR proposed to remove the getters and
setters and just expose the field mutably.
If we ever want to run additional code in a setter in some of these
fields, we can refactor back to a getter and setter pair without
impacting source or binary compatibility (forwards compatibility was the
argument in the olden C++ and Java days for pre-emptively wrapping
fields in getters and setters, but doesn't apply in JS land).
(🤖 This PR was generated using AI)
---
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache-2.0 license
0 commit comments