ts-type-forge
    Preparing search index...

    Type Alias StrictExclude<T, U>

    StrictExclude: T extends U ? never : T

    Excludes from union type T those types that are assignable to U. This is a stricter version that requires U to extend T.

    Type Parameters

    • T

      The union type to exclude from.

    • U extends T

      The type to exclude, must extend T.

    The union T minus U.

    type Union = 'a' | 'b' | 'c';
    type Remaining = StrictExclude<Union, 'a' | 'b'>; // 'c'
    // type Invalid = StrictExclude<Union, 'a' | 'd'>; // Error: 'd' is not assignable to Union