import { MatchExecutor } from '../internal/match-execution' ; import { matchCtorTester , matchFnTester , MatchTester , matchValueTester , } from '../internal/match-testing' ; import { isMatched , TrackedEither } from '../internal/match-tracking' ; import { Ctor , MapFnOrValue } from '../internal/common' ; description since example function match < TIn , TInExt extends TIn , TOut > ( ifInstanceOf , then ) ; description ## Match if `val` satisfies a  https since example function match < TIn , TInExt extends TIn , TOut > ( ifIsType , then ) ; description since example function match < TIn , TOut > ( ifTrue , then ) ; description since example function match < TIn , TOut > ( ifEquals , then ) ; description since example function match < TIn , TOut , TStructure extends Partial < TIn > > ( ifMatches , then ) ; function match < TIn , TOut , TInExt extends TIn = TIn > ( when , then ) { const delegate = ( t ) => { if ( isMatched ( t ) ) return t ; const cases = [ matchValueTester , matchCtorTester , matchFnTester , ] ; const match = cases . map ( c => c < TIn , TOut > ( t , when , then as MapFnOrValue < TIn , TOut > ) ) . find ( isMatched ) ; return match ?? t ; } ; return delegate ; } export { match , match as arm , match as when , } ;