All right, guys? Can anyone help me with this problem in TypeScript 2.3.
Problem: My backend sends me a property in Json with value 00 or 01, I need to convert to Regular or Extra. But I can not assign numbers in the Enum name, I already tried to make a switch inside the get method but nothing worked, could anyone help me?
export class Viagem { tipoViagem: string; descViagem: string;
public get $descViagem(): string {
switch (this.tipoViagem) {
case "00":
return "REGULAR";
case "01":
return "EXTRA";
} } }