Higher-order type functions in TypeScript?

You’re correct, it’s not currently representable in TypeScript. There’s a longstanding open GitHub feature request, microsoft/TypeScript#1213, which should probably be titled something like “support higher kinded types” but currently has the title “Allow classes to be parametric in other parametric classes”.

There are some ideas in the discussion about how to simulate such higher kinded types in the current language (see this comment for a concrete example), but in my opinion they probably don’t belong in production code. If you have some specific structure you’re tying to implement, maybe something appropriate can be suggested.

But in any case if you want to increase the chance (probably negligibly so, unfortunately) that this will ever happen you might want to go to that issue and give it a 👍 and/or describe your use case if you think it’s particularly compelling compared to what’s already there. Okay, hope that helps; good luck!

Leave a Comment