Suppose we have a string-valued enum
:
export enum SomeEnum {
Date = "date",
DateTime = "datetime"
}
How to declare a union type based on the enum member values, i.e.
export type SomeType = ...; // "date" | "datetime"
so that we would be able to do the following:
const a: SomeType = "date"; // Ok
const b: SomeType = "datetime"; // Ok
const c: SomeType = "c"; // Compile error