enum typescript return specific value

I have an enum like this:

enum Test {
   'type1',
   'type2',
   'type3',
   'type4',
   'type5'
}

function getType(num: number) {

}

what I want is if num = 1, return type1, if num = 2, return type2, if num >= 5, return type5.

How can I do this in getType ?



from Recent Questions - Stack Overflow https://ift.tt/33aWHR5
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)