4 ms·
This is great, thanks for sharing. I'm currently using @arrows/composition https://caderek.github.io/arrows/packages/composition/#pipe https://caderek.github.i
by Ideabile 4y ago
This is great, thanks for sharing.
I'm currently using @arrows/composition https://caderek.github.io/arrows/packages/composition/#pipe https://caderek.github.io/arrows/packages/composition/#pipe because of the light way library approach, which you seem to share.
I also try fp-ts https://github.com/gcanti/fp-ts https://github.com/gcanti/fp-ts but is a bit an academic style, so difficult to introduce in everyday work. Implementation of pipe: https://gcanti.github.io/fp-ts/modules/function.ts.html#pipe https://gcanti.github.io/fp-ts/modules/function.ts.html#pipe
I still need to wrap my head on your use of generics, but yours looks more flexible than the static type approach that other libraries (include RxJS) implements, does your pipe support types for any length of arguments? Does require a specific version of TypeScript?
Nice work.
- upzylon 4y agoThanks! Yes, it should work with any number of arguments. Or at least in theory it does, it seems that around 47 chained functions TypeScript will give up and stops computing the type. It's written in TypeScript v4.7.2 but I didn't use any recently introduced features, so it should also work a few version back. How far back exactly, I'd need to check.