export declare type ADTMember = Extract; declare type Matchers = { [D in ADT[Key]]: (v: ADTMember) => Out; }; export declare const matchOn: (key: K) => (matchObj: Matchers) => (v: ADT) => Z; export declare const matchOnI: (key: K) => (v: ADT) => (matchObj: Matchers) => Z; /** * Pattern matcher for matching over tagged unions whose discriminant value is "tag" * @example * ```ts * export type TicketDetail = | { tag: 'tracking' } | { tag: 'info' contents: TicketInfoRequest } | { tag: 'change' contents: TicketChangeRequest } declare const detail: TicketDetail pipe(detail, match({ tracking: () => "I'm super tracked!", info: i => i.contents.status, change: c => c.contents.justification })) * ``` */ export declare const match: (matchObj: Matchers<"tag", ADT, Z>) => (v: ADT) => Z; /** * Like {@link match} but inverted argument order * @example * ```ts * export type TicketDetail = | { tag: 'tracking' } | { tag: 'info' contents: TicketInfoRequest } | { tag: 'change' contents: TicketChangeRequest } declare const detail: TicketDetail matchI(detail)({ tracking: () => "I'm super tracked!", info: i => i.contents.status, change: c => c.contents.justification }) * ``` */ export declare const matchI: (v: ADT) => (matchObj: Matchers<"tag", ADT, Z>) => Z; export declare const matchS: (s: S) => (matchObj: { [M in S]: () => Out; }) => Out; export {};