Hacker News new | ask | show | jobs
by Tade0 1366 days ago
> 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.

1 comments

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