unsplash / pipe-ts

33 stars 4 forks source link

Should we have a "bailout" array overload? #5

Open OliverJAsh opened 5 years ago

OliverJAsh commented 5 years ago

Currently, there is a limit on the number of functions that can be passed to pipe (9).

We could have an overload that receives an array, to remove this limit.

This would also allow the use case of spreading an array of any length (rather than a tuple) into pipe: pipe(...myFns). However I would question if doing this is ever a good idea.

One downside of having this array overload is: type inference would disappear when you reach a certain threshold—pipe would return an function that returns unknown.

We tried to add this in the past, however we ran into a TS issue: https://github.com/unsplash/pipe-ts/issues/3.

Unfortunately this issue we ran into is expected TS behaviour: https://github.com/microsoft/TypeScript/issues/32269#issuecomment-509018747. Therefore this is currently a non-option (unless someone can find another a way around this issue).