Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Related Rants
Have a function that takes parameters and then performs a switch statement to determine what function to call next with those same parameters. One of those parameters is a Union type.
During CR, my reviewer said they’d like if instead of returning the function per case, I instead assigned a handler to the value of the function per case and then returned that handler at the end of the switch. Simple change, right? Only snafu, I’m casting one of the parameters on a per-case basis.
Somehow, through no fucking change of my own, TypeScript in its wisdom has decided that the type of that value by the time I call the next function is a fucking Intersection.
WHY THE FUCK DO YOU THINK IT’S AN INTERSECTION?! I’m fucking casting it per case! I’m ensuring it’s the right type for the next function called on a per case basis!
…. And that, my friends, is how I wasted a day with a stupid refactor that was ultimately just scrapped because no one could figure out how to make it work.
Goddamn fucking TypeScript. I
rant
why
typescript
fucking compiler
why can’t you be a real language