create type from string enum

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

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