instanceof doesn't work
See original GitHub issueThis should be mentioned under “Limitations” in the readme. The work-around is to compare with the name
property instead.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:12 (5 by maintainers)
Top Results From Across the Web
TypeScript instanceof not working - Stack Overflow
One workaround is to first cast object to the desired class and then check for a property against undefined . class User{ displayName:string;...
Read more >How to Fix instanceof Not Working For Custom ... - Danny Guo
In that case, instanceof doesn't work, which breaks any logic that is based on whether or not an error is a case of...
Read more >How to Fix instanceof Not Working For Custom ... - Medium
The recommended fix is to manually set the prototype in the constructor. Any custom errors which further extend DatabaseError still need the same...
Read more >instanceof not working · Issue #22585 · microsoft/TypeScript
index.ts class HttpError extends Error { } console.log(new HttpError() instanceof HttpError); transpiled with tsc index.ts run with node ...
Read more >instanceof - JavaScript - MDN Web Docs
The instanceof operator tests to see if the prototype property of a constructor appears anywhere in the prototype chain of an object.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
See https://github.com/babel/babel/issues/3083 for details.
You know, I think my current project is not importing this library (due to https://github.com/facebookincubator/create-react-app/issues/2952)Even with it added locally to babel-preset-react-app, it doesn’t log “ok”.