Hacker News new | ask | show | jobs
by jjnoakes 1202 days ago
When I see things like this I have a visceral reaction that I just can't get over.

https://www.typescriptlang.org/play#code/MYewdgziA2CmB00QHMA...

1 comments

Yeah, not wrapping your hook before sticking it in unknown interfaces is a recipe for visceral disease. They don't teach that in school these days?

Practice safe interactions - say no to unprotected injections.

Code looks fine to me. Classic blame the programmer mentality. Shame on you.
Hey, I think it's mutual responsibility on both API provider and user to engage in communication before mixing parts.

Who to blame is less important when you have an abandoned/orphaned child processes to take care of :/

No kink shaming, tho.

> I think it's mutual responsibility on both API provider and user to engage in communication before mixing parts

And I think it is the responsibility of the type system to at least catch if I'm passing too many arguments to a function.

TypeScript flags when I call a function that takes two parameters max with three arguments as an issue in many contexts, but not in contexts like this.

I understand why they chose to do this, but I reach for better type systems any time I have the choice.