space-lift
Version:
TypeScript Array, Object, Map, Set, Union, Enum utils
12 lines (11 loc) • 361 B
TypeScript
/**
* Creates a type safe string enumeration from a list of strings, providing:
* the list of all possible values, an object with all enum keys and the derived type of the enum in a single declaration.
*/
export declare function createEnum<T extends string>(...values: T[]): {
T: T;
enum: {
[K in T]: K;
};
values: ReadonlySet<T>;
};