CM6 Custom WidgetType killing program

When I try to construct a class that extends WidgetType, it kills the program. If I construct the class without extending WidgetType, the error goes away. Any idea what could cause this? Here’s my widget type.

class IconWidget extends WidgetType
    public icon: any;

    constructor(icon: any)
        this.icon = icon;

    public toDOM(view: EditorView): HTMLElement
        let element = document.createElement('span');


        return element;

What does ‘killing the program’ mean? Does it throw, does it lock up? I can’t see anything special about the class (and WidgetType itself is pretty unspectacular as well), and if I run this code nothing out of the ordinary happens, so I don’t have any suggestions.

Execution stops at the line where I try to instantiate the class. If I remove the WidgetType inheritance, it moves past that line. It doesn’t seem to throw an error in the console which definitely seems weird.

I do seem to be getting an error actually:

class constructors must be invoked with 'new'

I think this was an issue with my typescript target being es5 instead of es6.