Re:Show HN: Ezno, a type checker for JavaScript and optimise...
by staticassertion on Saturday September 24, 2022 @09:24AM
(#32962365)
Yeah, that's pretty different. That's still the programmer having to think about types as a separate entity or a runtime construct.
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.