ts-type-forge
    Preparing search index...

    Type Alias RelaxedExtract<T, U>

    RelaxedExtract: T extends U ? T : never

    Extracts from union type T those types that are assignable to U. This is a relaxed version that doesn't require U to extend T.

    Type Parameters

    • T

      The union type to extract from.

    • U

      The type to extract.

    The intersection of T and U.

    type Union = 'a' | 'b' | 'c';
    type Extracted = RelaxedExtract<Union, 'a' | 'd'>; // 'a'
    type Numbers = RelaxedExtract<string | number | boolean, number>; // number