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 {}
yarn install
yarn start
yarn test
yarn test:watch
yarn build