1. 10

TypeScript 2.2 introduced support for statically typed mixin classes. This post briefly explains mixins and shows how to use them in TypeScript.

  1.  

  2. 3
    type Constructor<T> = new (...args: any[]) => T;
    type Constructable = Constructor<{}>;
    
    function Timestamped<TBase extends Constructable>(Base: TBase) {
        return class extends Base {
            timestamp = Date.now();
        };
    }
    

    Hoo boy I was sure worried that ES5 was getting too hard to parse…thank god we’ve found ways of making code more readable and useful without giving in to architecture astronauting!

    EDIT:

    Just to be clear, the article is good @mariusschulz. :)

    I’m just annoyed at the ecosystem.

    1. 2

      I’ll re-invite your response from our discussion on irc the other day and say: Web Assembly is a ray of hope!