arrows
arrows copied to clipboard
Improvements for compose
Cool library! I've been hunting / trying to make a good compositional library with typescript support.
In my initial test here:
import { compose } from '@arrows/composition'
const addPrefixes = compose(
(text: string) => `prefix1-${text}`,
(text: string) => 3,
(text: string) => `prefix2-${text}`,
)
addPrefixes('arrows') // -> "prefix1-prefix2-arrows"
Here are some thoughts on how to improve typing:
- The parameter type of
addPrefixesshould bestring, because it's the parameter of the first function incompose. - You can see above I have the 2nd function which returns
3and the 4th which takes astringand that shouldn't be allowed.
Thank you, I will look into that.
@caderek "better late than never"
if this changes ok - i can fix pipe function next