@nevware21/ts-utils
    Preparing search index...

    Type Alias ValueOf<T>

    ValueOf: T[keyof T]

    Creates a union of all property values of a type.

    Type Parameters

    • T

      The type to extract values from.

    0.14.0

    const Direction = {
    Up: "up",
    Down: "down",
    Left: "left",
    Right: "right"
    } as const;

    type DirectionValue = ValueOf<typeof Direction>; // "up" | "down" | "left" | "right"

    function move(dir: DirectionValue) { }

    move("up"); // OK
    move("north"); // Error: not assignable