Hacker News new | ask | show | jobs
by captainmuon 1611 days ago
I think the attitude that they show in #1 - that TypeScript is only supposed to add typing to JavaScript and everything that goes beyond is bad - is wrong.

In fact, the only major problem I have with TypeScript is the lack of operator overloading [1]. This feature has been denied with the exact same justification. They will not add any feature that emits additional logic, so they cannot add operator overloading unless JS adds it. Also they will not add anything that needs runtime type lookup.

I think very simple, stupid syntactic sugar would be sufficient to solve 90% of use cases. For example, and please don't take this apart, I'm just making it up on the spot: transforming `a + b` to `a._op_add(b)` if a is not provably `any` or a primitive type.

Without operator overloading, for example vector math looks really ugly. I hope somebody will make at least a babel plugin or something to allow that.

[1]: https://github.com/microsoft/TypeScript/issues/6936