I am trying to make a operator similar to [RXJS pipe](https://rxjs.dev/api/index/function/pipe) that ingests a list of procedures and then processes them assembly-line style. However, Typescript is unable to check the dynamic typing of Reduce (the accumulator has a type based on the previous execution). Is there a proper way to do this?

```
const pipe = (...fns:Function[])=>{
   return fns.reduce((prevRes,curFn)=>curFn(prevRes),undefined)
}
pipe(
   ()=>true,
   (res:string)=>"res should be boolean, this should yell at you"
)

```