typescript enum to string enum to number typescript

The solution for “typescript enum to string enum to number typescript” can be found here. The following code will assist you in solving the problem.

enum AnEnum {
One = 1,
Two = 2
}
let stringOne = AnEnum[1]; // “One”
let stringTwo = AnEnum[AnEnum.Two]; // “Two”enum UserResponse {
No = 0,
Yes = 1,
}
console.log(UserResponse.Yes) //logs : 1

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in