type fn<T> = (...args: T[]) => T; export const flow = <T = any>(...fns: fn<T>[]) => (x0: T) => fns.reduce( (x, f) => f(x), x0 );