Essentially, my issue revolves around the restriction of not being able to have a property with the same name as used for a getter or setter. For more detailed information on this problem, you can refer to: Duplicate declaration TypeScript Getter Setter.
To work around this limitation, I have structured my class in the following manner (provided here is just one of its private fields):
export class RFilter
{
private _phone_model: string;
constructor(task: Task)
{
this.phone_model = task.phone_model;
}
set phone_model(val: string)
{
this._phone_model = val;
}
get phone_model(): string
{
return this._phone_model;
}
The challenge arises from the server expecting the field's name to be phone_model
, not
_phone_model</code. While I could name my getters and setters differently, like <code>Phone_model
, and rename the private field accordingly to phone_model
, it goes against convention.
What would be the most appropriate approach to address this issue?