import { Type } from './type'; declare class Case { type: Type; fn: (x: In) => Out; constructor(type: Type, fn: (x: In) => Out); } type InOfCase> = T extends Case ? In : never; type OutOfCase> = T extends Case ? Out : never; export declare class CaseSwitch> { cases: Cases[]; private memoAccept; constructor(cases: Cases[]); get accept(): Type>; run(val: InOfCase): OutOfCase; /** * Create a new CaseSwitch that also handles the specified case. */ when(type: Type, fn: (v: In) => Out): CaseSwitch>; } /** * Create a type switch that can be used with `match()`. */ export declare function when(type: Type, fn: (v: In) => Out): CaseSwitch>; /** * Match a value against a type switch created with `when()`. * * @example * const asString = t.match(foo, * t.when(t.array(t.str), xs => xs.join(' and ')) * .when(t.str, s => s) * .when(t.any, x => '' + x)) */ export declare function match>(val: InOfCase, sw: CaseSwitch): OutOfCase; export {};