Everlaw / nbts

NetBeans TypeScript editor plugin
282 stars 46 forks source link

Problem with manual adjusting of the prototype of the XError #141

Open PavelTurk opened 5 years ago

PavelTurk commented 5 years ago

Because of this I have to create custom error with manual adjusting of the prototype. For example

class FooError extends Error {
    constructor(m: string) {
        super(m);

        // Set the prototype explicitly.
        Object.setPrototypeOf(this, FooError.prototype);// LINE X
    }

    sayHello() {
        return "hello " + this.message;
    }
}

The problem is that plugin (3.0.1 (NetBeans 9.0)) shows me Property 'setPrototypeOf' does not exist on type 'ObjectConstructor'.... at LINE X. I changed code to (<any>Object).setPrototypeOf(this, FooErrorError.prototype) as described here but setPrototypeOf is red color anyway. At the same time I can compile without any problems both variants.

P.S. Thanks a lot for nice plugin!!!