@bytebury/sauce - v1.4.0
    Preparing search index...

    Type Alias KeyOf<T>

    KeyOf: T extends UnknownList ? ValueOf<T> : keyof T

    This is a utility type that allows you to get the keys from an object or list.

    If T is a type of list, then this behaves the same as ValuesOf.

    Type Parameters

    • T
    const MyEnum = { foo: 'bar', another: 'baz' } as const;
    const MyList = ['apple', 'banana', 'orange'] as const;

    function example(param: KeyOf<typeof MyEnum>): void {
    // param would be: "foo" | "another"
    }

    function example2(param: KeyOf<typeof MyList): void {
    // param would be: "apple" | "banana" | "orange"
    }