Variadic y-combinator for recursive anonymous functions.
npm i variadic-y
Define your recursive function to take in a reference to itself. Here,
;Yx == 1 ? y : fx - 1, x * y5; // 120
Unmemoized to enable usage with objects and referentially opaque functions.
If anyone knows how to properly type this combinator in TypeScript, let me know.