I feel like most of the typescript code i've been in recently looked like it needed 0 more class declarations.
I feel like most of the typescript code i've been in recently looked like it needed 0 more class declarations.
- Abstract classes are useful for defining nominal interface types
- Classes are a clear signal that a set of methods are designed to interact with related data types
- The prototype chain can be helpful for debugging where POJOs may lose information in the call stack
- JS runtimes can sometimes optimize classes in ways they can’t with POJOs
(btw, don’t try using Angular at all if you are already happy with your career)
React, Lit, angular, all use classes to define elements (yes you can use functions for a subset of components, but not all)
When the prototype chain is involved I think the value gained from structural typing tends to decrease -- or at least exposes the programmer to more sharp edges.