effect-io-ai

Package: effect
Module: Match

Match.Types.AddWithout

Adds a type to the exclusion filter, expanding what should be filtered out.

Details

This utility type manages the accumulation of excluded types during pattern matching. When multiple exclusions are applied, it combines them into a single filter representation.

Example (Accumulating excluded types)

import { Match } from "effect"

// AddWithout is used when combining multiple exclusions:
Match.type<string | number | boolean | null>().pipe(
  Match.not(Match.string, () => "not string"),
  Match.not(Match.number, () => "not number"),
  // Type system uses AddWithout to combine exclusions
  Match.orElse(() => "was string or number")
)

Signature

type AddWithout<A, X> = [A] extends [Without<infer WX>] ? Without<X | WX>
    : [A] extends [Only<infer OX>] ? Only<Exclude<OX, X>>
    : never

Source

Since v4.0.0