I'm using a library that has a bunch of strongly typed errors that I would like to catch and handle in my code. See https://github.com/ccxt/ccxt/blob/master/ccxt.d.ts#L12
The problem is, when the library throws one of these erorrs, I'm unable to figure out which error it is. I'm currently using instanceof, but it always returns false.
instanceof
What is the correct way in modern typescript to handle typed errors?
[edit] found this https://github.com/microsoft/TypeScript/issues/13965 - is it possible that it's just not a supported feature?
2.1m questions
2.1m answers
60 comments
57.0k users