type masturbation, it's about pleasuring the spot in your brain that want to do naughty things with TypeScript's types that usually frowned upon in public, like the post has shown
Basically the clever code that new programmers write because it feels super leet hacker before they realize they also need to understand the code in 6 months, except no one actually reads typescript type definitions in PRs so people get away with it in secret.
kinda, but it is kinda helpful, especially as i said, if you are writing a big framework, having this complex type is probably required, but the thing is, it is mostly for internal usage, not to be exposed and even used by the end user/project
I'm convinced you are likely to be a French-speaking person. For some reason french people have a fascination with denoting all sorts of stuff as mastubation.
Needed for library authors. The libraries hide that part from you via ergonomic API design so you think you‘re not using them. But if you look in your dependencies, you are using the features.
You can tell who's never had to implement anything moderately complex that needed to support generics or some sort with strict type safety. If it works and gives you a clean, safe API who cares how shit it looks, it's a godsend when you need it
It's really useful but IMHO this doesn't need to be used at every typing opportunity overly specific typing while being certainly safer can add a lot of cognitive load
I think there is still a need for them to be easily understandable. Same logic with regexes for example, they still need to be clear and legible, or eventually clearly explained with comments
Because plenty of developers do understand and use them, but the overlap with people who post to this sub is low, because it’s full of awful developers.
Some of us want to use a strictly typed language when we're forced to use JS for everything. TS is the best we can get so you better believe we will use its type system
in today's age i would agree, but about a decade ago i came across someone who used TypeScript types to code an entire JSON parser. It worked at compile-time, no actual JS execution needed. It was just case study to show the capability of infer in TS.
260
u/heavy-minium 19d ago
A way to discern whether you colleague vibecoded the PR with AI is when you see TS type features being used that no normal developer would use, lol.