ts-type-forge
    Preparing search index...

    Type Alias RelaxedExclude<T, U>

    RelaxedExclude: T extends U ? never : T

    Excludes 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 exclude from.

    • U

      The type to exclude.

    The union T minus any types assignable to U.

    type Union = 'a' | 'b' | 'c';
    type Remaining = RelaxedExclude<Union, 'a' | 'd'>; // 'b' | 'c'
    type NonStrings = RelaxedExclude<string | number | boolean, string>; // number | boolean