TypeScript doesn't directly support higher-kinded types yet, but various attempts have been made to simulate them (see related work at the bottom). This project presents a new, greatly simplified approach to encoding HKTs using the power of conditional types.
The idea is that, although we can't truly abstract over a type constructor type
T<A> = ..., we can abstract over the result T<_> of applying it to a special placeholder type . Then, if we can somehow substitute all instances of within a type, we effectively have the ability to "apply" T at arbitrary types. That is, we can abstract over T! And it turns out we can define a substitution operator $<T, S> which does just that.https://github.com/pelotom/hkts
#ts