|
|
|
|
|
by RangerScience
664 days ago
|
|
Not defending that code - and I agree with you that wild TS code gets nightmarish (I usually call it a “type explosion”) but Waaaay back when in my C++ days, starting to get into template metaprogramming, the “aha!” moment that made it all much easier was that the type definition could be thought of as a function, with types as input parameters and types as output parameters Recentlyish, this same perspective really helped with some TS typing problems I ran into (around something like middleware wrapping Axios calls). It’s definitely a “sharp knife” if you overuse it, you screw yourself, but when you use it carefully and in the right places it’s a super power. |
|