import { Fn } from '../Fn'; import { Invoke } from '../Invoke'; import { Reducer } from '../types'; import { HandleNever, IfInvoking, Input } from '../utils'; export type ReducerFn = Fn, Accumulator>; export interface Reduce, InitialValue extends F['out']> extends Fn { out: IfInvoking>, F['out']>; } export type InvokeReduce, InitialValue extends F['out'], List extends F['in']['current'][]> = List extends [ infer First extends F['in']['current'], ...infer Rest extends F['in']['current'][] ] ? InvokeReduce>>, Rest> : InitialValue;