import type { OmitWithTag2 } from './core/types.js'; import type { GetTag, GetTagProperty, SomeTaggedRecord } from './record/types/controller.js'; export type SomeTag = string; export type SomeMatchHandler = (data: string | object) => unknown; export interface TagMatcherDefinition { _tag: 'TagMatcherDefinition'; tag: string; handler: SomeMatchHandler; } export interface DataMatcherDefinition { _tag: 'DataMatcherDefinition'; tag: string; dataPattern: object; handler: SomeMatchHandler; } interface Match { (tag: Tag): ChainTagPreMatcher; (algebraicDataType: AlgebraicDataType): ChainPreMatcher; } export declare const match: Match; type PickWithTag = ADT extends SomeTaggedRecord ? ADT : never; type ChainPreMatcher = { [Tag in GetTag]: (>>>(dataPattern: Pattern, handler: (data: Pattern & PickWithTag, test: Pattern) => ThisResult) => ChainPostMatcher) & ((handler: (data: PickWithTag) => ThisResult) => ChainPostMatcher); }; /** * 1. When an unqualified variant matcher has been defined then * it should not be definable again in the chain since it would * never be called at runtime */ type ChainPostMatcher = { [Tag in Exclude, TagsPreviouslyMatched>]: ((>>>(dataPattern: Pattern, handler: (data: Pattern & PickWithTag) => ThisResult) => ChainPostMatcher) & ((handler: (data: PickWithTag) => ThisResult) => ChainPostMatcher)); } & (Exclude, TagsPreviouslyMatched> extends never ? { done: () => Result; } : { else: (value: ThisResult | ((data: ExcludeByTag) => ThisResult)) => Result | ThisResult; }); type ChainTagPreMatcher = { [ThisTag in Tags]: ((handler: () => ThisResult) => ChainTagPostMatcher); }; type ChainTagPostMatcher = { [ThisTag in Exclude]: ((handler: () => ThisResult) => ChainTagPostMatcher); } & (Exclude extends never ? { done: () => Result; } : { else: (value: ThisResult | ((data: Exclude) => ThisResult)) => Result | ThisResult; }); type ExcludeByTag = TaggedRecord extends { [k in GetTagProperty]: Tag; } ? never : TaggedRecord; export {}; //# sourceMappingURL=match.d.ts.map