create type from string enum

Solutions on MaxInterview for create type from string enum by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "create type from string enum"
Eduardo
11 Oct 2018
1const GENDERS = ["MALE", "FEMALE", "DIVERSE"] as const;
2type Gender = typeof GENDERS[number];
similar questions
typescript string to enum