Skip to content

Incorrect instanceof behavior when extending native Error #12853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
whatisaphone opened this issue Dec 12, 2016 · 2 comments
Closed

Incorrect instanceof behavior when extending native Error #12853

whatisaphone opened this issue Dec 12, 2016 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@whatisaphone
Copy link

TypeScript Version: 2.1.4

Code

class TestError extends Error { }
const works = (new TestError()) instanceof TestError;
console.log(works);

Expected behavior: (and behavior in Node.js 6.2.1)

works is true

Actual behavior:

works is false

@DanielRosenwasser DanielRosenwasser added the Duplicate An existing issue was already created label Dec 12, 2016
@DanielRosenwasser
Copy link
Member

Sorry about this - it was an intentional breaking change and documented here. Sorry about the inconveniences you may have encountered.

Marking this issue as a duplicate of #12123.

@whatisaphone
Copy link
Author

That's what I get for not reading the release notes! Thanks for the link.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants