0
All right, guys ? Can anyone help me with this problem in Typescript 2.3.
Problem: My back-end sends me a property in Json with value 00 or 01, I need to convert to Regular or Extra. However I can not assign numbers in the name of Enum, I tried to make a switch inside the get method but nothing worked, someone could help me ?
export class Viagem { tipoViagem: string; descViagem: string;
public get $descViagem(): string {
switch (this.tipoViagem) {
case "00":
return "REGULAR";
case "01":
return "EXTRA";
} } }
You can post the Switch you made?
– Lucas Brogni
@Lucasbrogni, of course, added.
– Victor Oliveira
Where is the
enum
?– Maniero
Enum I can’t create because I can’t add names like 00 and 01
– Victor Oliveira
@Victoroliveira I believe the problem is that you are not giving a break; no case.
– Lucas Brogni