4 ms·
catch (e) { const error = e as <Your custom error type>; }
by shams93 4y ago
catch (e) {
const error = e as <Your custom error type>;
}
- raydiatian 4y agoOn an aside, how do you feel about this? Typescript was supposed to bring type visibility to JavaScript. But this still feels like bring your own research. If you input the wrong <Your custom error type>, TS compiler won’t prompt you. This makes me sad.