top | item 19074760

(no title)

sowhatquestion | 7 years ago

> How do you compose two base classes into a subclass?

In most other OOP languages besides JS, the obvious answer would be to use traits.

discuss

order

mambodog|7 years ago

Traits are okay: React 'Mixins' which I mentioned in my parent post are basically traits but at the framework level, which allows them to be smart about composing/merging the use of framework functionality normally accessed by overriding superclass methods (eg. componentDidUpdate). Traits still have the composability issues I mentioned for React Mixins: how do you avoid collisions between the namespaces of different traits while still allowing some to compose others?

mst|7 years ago

Hence why I've been playing around with class decorators and friends to try and figure out a nice way to do method modifiers, traits, etc.

But I got sidetracked with "but howtf do I make typescript understand the resulting signatures" and then got nerd sniped by something else.

Hopefully eventually I'll get back to it.