You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was an intentional change in 2.2 (see #12123 and the section on our wiki), but is difficult to overcome through compilation. I believe there's some conversation in #12790 for workarounds.
A workaround you can take now is create an intermediate class that you can extend from.
In TypeScript 2.2, you'll be able to set the prototype on your own.
// Use this class to correct the prototype chain.exportclassMyErrorextendsError{__proto__: Error;constructor(message?: string){consttrueProto=new.target.prototype;super(message);// Alternatively use Object.setPrototypeOf if you have an ES6 environment.this.__proto__=trueProto;}}
TypeScript Version: 2.1.5
Code
Expected behavior:
(error instanceof HttpLoginError); //returns true
(error instanceof HttpError); //returns true
(error instanceof Error); //returns true
Actual behavior:
(error instanceof HttpLoginError); //returns false
(error instanceof HttpError); //returns false
(error instanceof Error); //returns true
The text was updated successfully, but these errors were encountered: