What are your favorite type system hacks?

100 points OS6aDohpegavod4

Learning Rust, the Typestate Pattern felt like a magical unicorn to me. Since then we've also been afforded other mechanisms, like const generics or 1.79's inline const, for enforcing invariants at compile time.

I couldn't find recent threads about this - what are some of your favorite hacks of the type system to get more of that sweet compile time checking? Or any kind of type system hacks, for that matter (e.g. ergonomics)?