Well basically my problem boils down to the fact that I can't have property with the same name I used for a getter or setter. This issue has more details: Duplicate declaration TypeScript Getter Setter.
So in order to avoid it I create my class in the following way (Here I show just one 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 problem with this is that the server expects the field's name to be phone_model
, not _phone_model
. I understand I could give my getters and setters names like Phone_model
and then rename the private field to phone_model
but...it would be against the conventions.
What would be the right way to handle this?