Disappointed that the article alluded to but never explains why classes should be avoided in Typescript. (Which I agree, btw) If you’re used to classes, it’s really tempting to create classes for your models. But in Typescript, which gets compiled down to plain old JavaScript, you spend a lot of your time dealing with JSON and plain old JavaScript objects (POJO). These don’t have methods. These don’t have private mem…
This sounds very arbitrary, opinionated, and unconvincing. If a class is a co-location of data and methods performed on it, then how is this class: class Foo { constructor(value) { this.value = value; } addOne() { this.value++; } getValue() { return this.value; } } const foo = new Foo(1); any worse than this POJO: const foo = { value: 1, addOne() { this.value++; }, getValue() { return this.value; } } Besides, what ar…
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...