Closed
Description
π Search Terms
instanceof or unknown
π Version & Regression Information
- Didn't think of it until 4.4 when caught values became unknown, but the actual problem has probably been present for a long time.
See #38309, for instance.
β― Playground Link
π» Code
class WebError extends URIError {
status?: number;
}
try {
// Make a request
} catch (err) {
if (err instanceof WebError === false || err.status != 401) {
console.error(err);
}
}
π Actual behavior
The compiler thinks err
is unknown
and does not understand that err.status must be a valid property.
π Expected behavior
No compiler error.
Additional information about the issue
No response
Metadata
Metadata
Assignees
Labels
No labels