Type Alias ExtractKeysWithMatchingValues<OriginalObject, Matcher>

ExtractKeysWithMatchingValues<OriginalObject, Matcher>: keyof {
    [Prop in keyof OriginalObject as OriginalObject[Prop] extends Matcher
        ? Prop
        : never]: Prop
}

Performs keyof on all keys within the OriginalObject that have values matching the given Matcher.

Type Parameters

  • OriginalObject extends object
  • Matcher
import {ExtractKeysWithMatchingValues} from '@augment-vir/common';

type ExtractedKeys = ExtractKeysWithMatchingValues<{a: RegExp; b: string}, string>;
// `ExtractedKeys` is `'b'`