Hacker News new | past | comments | ask | show | jobs | submit login

> please tell me if I'm wrong

There's no exact equivalent, but you can use generic functions or function overloads to achieve something similar:

https://www.typescriptlang.org/docs/handbook/2/functions.htm...

Of course it won't select an implementation for you, so you'll have to handle all the possible type combinations yourself in the function body.




Yeah, that's pretty different. That's still the programmer having to think about types as a separate entity or a runtime construct.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: