Skip to content

Instantly share code, notes, and snippets.

@ruslanguns
Last active December 27, 2022 08:57
Show Gist options
  • Select an option

  • Save ruslanguns/d5a6bd9af6bddb77d6b2f2a2fef82748 to your computer and use it in GitHub Desktop.

Select an option

Save ruslanguns/d5a6bd9af6bddb77d6b2f2a2fef82748 to your computer and use it in GitHub Desktop.
enumToString
/**
* Converts an enum into a String
* @param _enum Enum
* @returns string type
* @gist https://gist.github.com/ruslanguns/d5a6bd9af6bddb77d6b2f2a2fef82748
*/
export const EnumToString = (_enum: object) =>
Object.keys(_enum)
.map(key => _enum[key])
.filter(value => typeof value === 'string') as string[]
@duranduranduran
Copy link

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment