@handtracking.io/yoha
Version:
Yoha is currently available for the web via JavaScript. More languages will be added in the future. If you want to port Yoha to another language and need help feel free reach out.
20 lines (19 loc) • 548 B
TypeScript
/**
* @public
* A small helper that is used to build a type consisting of all values of an object literal.<br/>
*
* @example
* ```
* const MyEnum = {
* ENUM_VALUE_ONE: "value_one",
* ENUM_VALUE_TWO: "value_two",
* } as const;
* type PossibleEnumValues = ObjValues<typeof MyEnum>
* ```
* Here `PossibleEnumValues` will resolve to the type `'"value_one" | "value_two"'`.
*
* @remarks
*
* This is used to work around native enums (and some of their limitations) in TypeScript.
*/
export declare type ObjValues<T> = T[keyof T];