FuncType - v0.8.85
    Preparing search index...

    Interface Matchable<A, Tags>

    Pattern matching interface for functional data types.

    interface Matchable<A, Tags extends string = string> {
        match<R>(patterns: Record<Tags, (value: A) => R>): R;
    }

    Type Parameters

    • A

      The type of elements in the data structure

    • Tags extends string = string

      The type of tags used for pattern matching

    Hierarchy (View Summary)

    Index

    Methods

    Methods

    • Pattern matches against this data structure, applying handlers for each variant based on tag. Similar to fold but with stronger type safety for tag-based variants.

      The return type is inferred from the pattern handlers when not explicitly specified.

      Type Parameters

      • R

      Parameters

      • patterns: Record<Tags, (value: A) => R>

        An object containing handler functions for each variant

      Returns R

      The result of applying the matching handler function