I like to think I can usually look at code in languages I don't know and still get the gist of what it does but I am drawing a complete blank. Is this even slightly legible to anyone and if yes please explain
This is a Typescript type-level computation (which is Turing-complete AFAIK).
However this kind of trickery is usually done for fun and to explore how much could be achieved just on the compile step.