utilitypes-ts
    Preparing search index...

    Type Alias ValueOf<T, K>

    ValueOf: Normalize<T>[K]

    Extracts the value types of an object T.

    By default, it returns a union of all property values. You can optionally provide a subset of keys K to extract only specific value types.

    Type Parameters

    • T

      The target object type

    • K extends UnionKey<T> = UnionKey<T>

      Keys of T to extract values from (defaults to all keys)

    type Result = ValueOf<{ a: string; b: number }>;
    // ^?
    // string | number
    type Result = ValueOf<{ a: string; b: number; c: boolean }, "a" | "c">;
    // ^?
    // string | boolean
    type Result = ValueOf<{ a: string } | { b: number }>;
    // ^?
    // string | number | undefined