Hex Core JS
    Preparing search index...

    Type Alias KeyWithValueType<T, Allowed>

    KeyWithValueType: { [K in keyof T]: T[K] extends Allowed ? K : never }[keyof T]

    KeyWithValueType is the keys from a given a Record type whose values are of a type that extends Allowed.

    Type Parameters

    • T extends Record<any, any>
    • Allowed
    type Obj = {
    a: number;
    b: number;
    c: string;
    d: boolean;
    }

    KeyWithValueType<Obj, number> // "a" | "b"
    KeyWithValueType<Obj, string | boolean> // "c" | "d"

    T The record type with keys.

    Allowed The allowed value type.