Skip to main content
Module

x/mixwithts/mod.ts>mix

TypeScript compatible version of Justin Fagani's mixin library for ES6
Latest
variable mix
import { mix } from "https://deno.land/x/mixwithts@1.1.2/mod.ts";

A fluent interface to apply a list of mixins to a superclass.

class X extends mix(Object).with(A, B, C) {}

The mixins are applied in order to the superclass, so the prototype chain will be: X->C'->B'->A'->Object.

This is purely a convenience function. The above example is equivalent to:

C = Mixin(C)
B = Mixin(B)
A = Mixin(A)
class X extends C(B(A(Object))) {}

type

<C extends Constructable>(superclass?: C) => MixinBuilder<C>