This gave me PTSD flashbacks to template metaprogramming in C++.
Once I spent all night trying to extract boost's FOR_EACH macro from the boost library for use in a commercial game engine. ("Just use boost" wasn't acceptable for gmedev, for pretty solid reasons which I have since forgotten.)
I'm pretty sure there is a way to encode a Prolog interpreter with TypeScript's type system but it sounds like a daunting task so I haven't tried it
Equality is probably the one I like most because it seems to be very useful (at least in the types of things I've dabbled with). I'll look into extracting some more from some libraries I wrote but not promising anything.