Type alias InferKey<T>

InferKey<T>: EnumToUnion<ReturnType<T["keys"]>[number]>

Utility type to infer type of key for a labeled enum.

Type Parameters

Example

const LOCALES = Enum({ English: 'en', Czech: 'cs', Slovak: 'sk' });
type LocaleKey = InferKey<typeof LOCALES>; // Locale is 'English' | 'Czech' | 'Slovak'

Generated using TypeDoc