For this piece of code
try {
throw new CustomError();
}
catch (err) {
console.log(err.aPropThatDoesNotExistInCustomError);
}
err is any and doesn't trigger type errors. How can it be narrowed down to the type that error is expected to be?
For this piece of code
try {
throw new CustomError();
}
catch (err) {
console.log(err.aPropThatDoesNotExistInCustomError);
}
err is any and doesn't trigger type errors. How can it be narrowed down to the type that error is expected to be?