class Person {
name!: string
age!: number
private gender!: "aircraft"
}
class Profile {
name!: string
avatar!: string
protected something!: {}
}
export class User extends mixin(Person, Profile) {
id!: number
asd() {
this.gender // => Error: Property is private
this.something
}
}
const user = new User
user.gender // => Error: Property is private
user.something // => Error: Property is protected
user instanceof User // === true
user instanceof Person // === true
user instanceof Profile // === true
user instanceof mixin(Person, Profile) // === true- a mixin class can define public/protected/private property visibility.
- a mixin class can't define a constructor
- mixin classes must match or error will be shown at
mixin(Person, Profile). - a class that extends a mixin can be checked with
instanceoffor each class and altogether.
When inspecting a property from a mixin, your IDE will display what this type belongs to.

When inspecting super, your IDE will display the mixins.