Re:How JavaScript works: 3 types of polymorphism
by Kinrany on Sunday May 09, 2021 @08:31PM
(#27101288)
In TypeScript classes are in no way foundational. At the type level they are roughly implemented as a combination of two types: the instance type and the "newable" constructor function type.
Re:How JavaScript works: 3 types of polymorphism
by desert_boi on Sunday May 09, 2021 @08:34PM
(#27101321)
Typescript works perfectly well without classes, even better sometimes (see decorators and Typescript).
The shape of data is more foundational than classes. An object without a class is a perfectly good way to organize data too, based on its shape.
It's fine to want to go functionally heavy, but if you're not using classes - which are the foundation of 'types' - then why bother with 'type'script? (Unless you mean to say 'interface'? Which is obviously not 'class' but implies the same usage of OO-founded keywords)