const MyEnum = { foo: 'bar', another: 'baz' } as const;
const MyList = ['apple', 'banana', 'orange'] as const;
function example(param: ValueOf<typeof MyEnum>): void {
// param would be: "bar" | "baz"
}
function example2(param: ValueOf<typeof MyList): void {
// param would be: "apple" | "banana" | "orange"
}
This is a utility type that allows you to get the values from an object or a list.