Hacker News new | ask | show | jobs
by moron4hire 1709 days ago
That's creating a new type B. In contrast, interfaces can have their definition spread across multiple code units.

    interface X {
        x(): void;
    }

    interface X {
        y(): void;
    }

    class Y implements X {
        x(): void {
            console.log("hello");
        }

        y(): void {
            console.log("world");
        }
    }

    const z = new Y();
    z.x();
    z.y();

This is important for keeping up with API changes in browsers that may happen faster than the DefinitelyTyped project can keep up.