effect-io-ai

Package: effect
Module: Match

Match.Types.NotMatch

Computes the remaining type when a pattern P is excluded from type R.

Details

This utility type determines what type remains after a Match.not pattern excludes certain values. It’s the complement of WhenMatch, calculating what’s left after removing the matched portion.

Example (Computing unmatched types)

import type { Match } from "effect"

// NotMatch computes what remains after exclusion
type NotString = Match.Types.NotMatch<
  string | number | boolean,
  typeof Match.string
>
// Result: number | boolean

type NotSpecificValue = Match.Types.NotMatch<"a" | "b" | "c", "a">
// Result: "b" | "c"

Signature

type NotMatch<R, P> = Exclude<R, ExtractMatch<R, PForNotMatch<P>>>

Source

Since v4.0.0