Match43
Constructors
Models
CasetypeRepresents a single pattern matching case.MatchertypeUnion type for matchers created by Match.type and Match.value.NotinterfaceRepresents a negative pattern matching case.SafeRefinementinterfaceA safe refinement that narrows types without runtime errors.TypeMatcherinterfaceRepresents a pattern matcher that operates on types rather than specific values.ValueMatcherinterfaceRepresents a pattern matcher that operates on a specific provided value.WheninterfaceRepresents a positive pattern matching case.Completion
exhaustiveconstCompletes a matcher that handles every remaining input case.optionconstWraps the match result in an Option, representing an optional match.orElseconstProvides a fallback value when no patterns match.orElseAbsurdconstReturns a matcher that throws an error if no pattern matches.resultconstWraps the match result in a Result, distinguishing matched and unmatched cases.Defining Patterns
discriminatorconstMatches values based on a specified discriminant field.discriminatorsconstMatches values based on a field that serves as a discriminator, mapping each possible value to a corresponding handler.discriminatorsExhaustiveconstMatches values by a discriminator field and requires every possible case to be handled.discriminatorStartsWithconstMatches values where a specified field starts with a given prefix.notconstCreates a pattern that excludes a specific value while allowing all others.tagconstMatches discriminated union members by their _tag field.tagsconstMatches values based on their _tag field, mapping each tag to a corresponding handler.tagsExhaustiveconstMatches values based on their _tag field and requires handling of all possible cases.tagStartsWithconstMatches values where the _tag field starts with a given prefix.whenconstDefines a condition for matching values.whenAndconstMatches a value that satisfies all provided patterns.whenOrconstMatches one of multiple patterns in a single condition.Predicates
anyconstMatches any value without restrictions.bigintconstMatches values of type bigint.booleanconstMatches values of type boolean.dateconstMatches values that are instances of Date.definedconstMatches any defined (non-null and non-undefined) value.instanceOfconstMatches instances of a given class.instanceOfUnsafeconstChecks whether a value is an instance of a constructor without type-safe narrowing.isconstMatches a specific set of literal values (e.g., Match.is("a", 42, true)).nonEmptyStringconstMatches non-empty strings.numberconstMatches values of type number.recordconstMatches non-null objects other than arrays.stringconstMatches values of type string.symbolconstMatches values of type symbol.