Re:If Inheritance is so bad, why does everyone use it?
by chuckadams on Friday April 12, 2024 @02:01PM
(#40015790)
Typescript is best when you don't use `class` or `this` at all, but instead return object literals of static closures. In other words, more like this:
This is the typical style of most VueJS code (though it would replace count with a ref and probably call the function `useCounter`). TypeScript is smart enough that it can infer interfaces and even classes from such literals should you go that way, full support for substitutability checking and all.
[ Parent
| on HN ]
There are no comments on this comment yet.