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

Classes are very underutilised in TypeScript. I recently introduced them to our codebase at my day job and got a fair bit of pushback because it wasn’t “JavaScripty” enough.



That's a weird objection, because Typescript classes are literally Javascript classes[1].

[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...


There was plenty of outrage when classes were added to JS. “JS uses prototypal inheritance, not OOP!”


I'm still a bit cranky about that, but because objects should be good enough for anyone. They aren't even really classes anyway.


If it walks like a duck, and quacks like a duck, for all intents and purposes, it is a duck.


I like classes well enough; I just find that often they over-complicate simple code, especially when you introduce inheritance. Since classes are effectively just syntax sugar I often find it's more intuitive to go with object syntax but to each their own. So long functionality is isolated in modules I'm happy.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: