Skip to content

Instantly share code, notes, and snippets.



Last active Apr 3, 2021
What would you like to do?
Simple strongly typed pipe function
type OperatorFn<T> = (value: T) => T;
interface PipeFn {
<T>(...fns: OperatorFn<T>[]): (value: T) => T;
const pipe: PipeFn = (...fns) => value =>
fns.reduce((val, fn) => fn(val), value);
export default pipe;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment