UNPKG

tiny-types

Version:

A tiny library that brings Tiny Types to JavaScript and TypeScript

13 lines (12 loc) 640 B
import { List } from '../types'; import { MatcherRule } from './rules'; /** * @access private */ export declare abstract class PatternMatcher<Input_Type, Pattern_Type, Matching_Type, Output_Type> { protected readonly value: Input_Type; protected readonly rules: List<MatcherRule<Input_Type, Output_Type>>; constructor(value: Input_Type, rules?: List<MatcherRule<Input_Type, Output_Type>>); abstract when(pattern: Pattern_Type, transformation: (v: Matching_Type) => Output_Type): PatternMatcher<Input_Type, Pattern_Type, Matching_Type, Output_Type>; else(transformation: (v: Input_Type) => Output_Type): Output_Type; }