News for hackers. Stuff that matters.
Re:A generically typed pipe function in TypeScript by aabbcc1241 on Sunday August 07, 2022 @12:40PM (#32377756)
An easier alternative is to wrap the value into an array, then use `.map()` for each function in the chain, and finally escape the value with `[0]`

I made a similar data structure[1] to allow adding side effect (no return value) as part of the chained function.

[1] https://github.com/beenotung/tslib/blob/9f9a9274c1e13be7ba83...

Re:A generically typed pipe function in TypeScript by reeeeee on Monday August 08, 2022 @04:23AM (#32383404)
If you extract this `Chain` class to a separate package, I would gladly reuse it in my applications. I've been thinking about creating a `Vavr`[0] clone in typescript, as I really like the syntax used in that library, especially the `Try` construct.

[0] https://www.vavr.io/

Re:A generically typed pipe function in TypeScript by jhardy54 on Sunday August 07, 2022 @11:55PM (#32382270)
This works great for small datasets, but often you’ll have to eventually use streams rather than arrays. I’ve used pull-stream to do this in the past.
Re:A generically typed pipe function in TypeScript by andreareina on Monday August 08, 2022 @12:26AM (#32382387)
.use is a nice quality of life feature!