## Simplest approach
```
enum Color { Red, Green }

const c1 = Color["Red"]
const redStr = "Red" // important: use `const`, not mutable `let`
const c2 = Color[redStr]
```
This works both for [numeric][1] and [string][2] enums. No need to use a [type assertion][3].

## Unknown enum strings
#### Simple, unsafe variant
```
const redStrWide: string = "Red" // wide, unspecific typed string
const c3 = Color[redStrWide as keyof typeof Color]
```
#### Safe variant with checks
```
const isEnumName = <T>(str: string, _enum: T): str is Extract<keyof T, string> =>
    str in _enum
const enumFromName = <T>(name: string, _enum: T) => {
    if (!isEnumName(name, _enum)) throw Error() // here fail fast as an example
    return _enum[name]
}
const c4 = enumFromName(redStrWide, Color)
```
## Convert string enum values
[String enums][2] don't have a [reverse mapping][4] (in contrast to numeric ones). We can create a lookup helper to convert an enum value string to an enum type:
```
enum ColorStr { Red = "red", Green = "green" }

const c5_by_name = ColorStr["Red"] // ✅ this works
const c5_by_value_error = ColorStr["red"] // ❌ , but this not

const enumFromValue = <T extends Record<string, string>>(val: string, _enum: T) => {
    const enumName = (Object.keys(_enum) as Array<keyof T>).find(k => _enum[k] === val)
    if (!enumName) throw Error() // here fail fast as an example
    return _enum[enumName]
}

const c5 = enumFromValue("red", ColorStr)
```
[Playground sample][5]


  [1]: https://www.typescriptlang.org/docs/handbook/enums.html#numeric-enums
  [2]: https://www.typescriptlang.org/docs/handbook/enums.html#string-enums
  [3]: https://www.typescriptlang.org/docs/handbook/basic-types.html#type-assertions
  [4]: https://www.typescriptlang.org/docs/handbook/enums.html#reverse-mappings
  [5]: https://www.typescriptlang.org/play?jsx=0#code/PTCwCgQAgRgSigZwJYFsAOAbApogLlAIbroBOA9oQMYAWEIE2AdgK6pQDC5m5pUA3lABK2ACYAaKAHFS2ZlAC+EKuSb4oVGFAC8nbrwDaAIhGijAXWWr1s0QGU8fXSbFGo0NOl55CTPAC4oFkRsKAADFTU8MMkmcgJUFh8AIxxwnGirKI0AJh09HlIDWwdSS3B6MEhgKByEFiYAaziAdyYoZjYkR2QmAHNESqybMVKAdWRRbED8Ul6+-JczdxqWyexJBsR0bCpkADNkKig8AE8d0W65-ohK2sIEFAwcTbVCfdCAN0I53zxhghUADM+S4hWKo0cEymREQUEa2FO5H2J3O2GRBV45TuOWSj3eXx+yD+AKgyEQAFFWKgAHKEVChXQAHgAKgA+AAUsxmPX6kgA+p1UIEWXAeXxyVAKQAPRzUPBMhFIlEsySzeZsnRsiBQXVXMntQXU0lCgBiFFp9MZUFZnKYVvF8wFQpFCG0mv4Or1BygHIAhOSqWw6QyOfaGc7qXAEHgaBQWlLSBRSByENAaNhZFB9oRkJhs4R1IWiO1sNL6VhsF7dbI8CxSIahQZw9hykoKuBIuoqAAWfJmi0h7AckpQ9aSMG8OC3ap3IEILhMT6Zgjq-odalQb6YFihIbgIWY0ilATCMSLWxGSQyOTtZx9WTMNzt0lUACs-KVoP0x8cxlMFgrFAgCg5CcNCSi0vCNIMnbWICH6Zsm36FKUxiXuYQGADLkUCSMkSRgZKcT-B2XYEAO5CoAAaoQO7WqyHSyswohwiIKikKITJrn0aq8n0bKctujp8lARpsK6WoCNWGhwRuwZWvkHIAPLJAAVrseAAHRKogHKiagCDFgAgkmhCnIqiIYuycAaYcTCiByjQSXpBiNBh2juVuNHTuAepkii-pCkOMZxuQCYUkmvCpkBGZZjmeYFkWcK+AxFY4FJtb1o21IGIFVptjOpEaG+-bUuaFHUbRHJGJeE4-qUcBAA