class Base {}
const NameMixin = Mixin(<T extends Constructor>(superclass: T) => class extends superclass { name = "Node" })
const IdMixin = Mixin(<T extends Constructor>(superclass: T) => class extends superclass { id = nanoid() })
class MyClass extends mix(Base).with(NameMixin, IdMixin) {}
console.log(new MyClass()) // MyClass { name: 'Node', id: '2FHGySBlhFAMRwkiMiU9D' }
if (myClass instanceof SomeMixin) doSomething()
type NameMixinType = MixinType<typeof NameMixin>
type IdMixinType = MixinType<typeof IdMixin>
type UserType = NameMixinType & IdMixinType
class User extends mix(Base).with(NameMixin, IdMixin) implements UserType {}
Start the app in development mode
Generate bundles and typings, create docs