Title: Falsy instanceof check doesn't affect righthand or expression · Issue #55395 · microsoft/TypeScript · GitHub
Open Graph Title: Falsy instanceof check doesn't affect righthand or expression · Issue #55395 · microsoft/TypeScript
X Title: Falsy instanceof check doesn't affect righthand or expression · Issue #55395 · microsoft/TypeScript
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. ⏯ Playgro...
Open Graph 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 t...
X 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 ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/55395
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Falsy instanceof check doesn't affect righthand or expression","articleBody":"### 🔎 Search Terms\n\ninstanceof or unknown\r\n\n\n### 🕗 Version & Regression Information\n\n- 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.\r\n\r\nSee #38309, for instance.\r\n\n\n### ⏯ Playground Link\n\nhttps://www.typescriptlang.org/play?ts=5.2.0-beta#code/MYGwhgzhAEDqCmAjAogJ1Qe1deAPALvAHYAmMAqgEoCSam2A3gLABQ070E+Y+ArhAH4AXNCK8AtonioA3KwC+rVvlQBPaMzYcA9NugBZMAGt40MNFTwAjr3hcF0YD2AALaAAppqAJQbWHaABLADMPLyCiLjAiYHgMUIQUdCxoAF506GCwEAhTAB88nHQAOii+GABCVOgAFgAGAEZfTQCA4AxIjBB4Yq8sT3RvOS12RRYxoA\n\n### 💻 Code\n\n```ts\r\nclass WebError extends URIError {\r\n status?: number;\r\n}\r\n\r\ntry {\r\n // Make a request\r\n} catch (err) {\r\n if (err instanceof WebError === false || err.status != 401) {\r\n console.error(err);\r\n }\r\n}\r\n```\r\n\n\n### 🙁 Actual behavior\n\nThe compiler thinks `err` is `unknown` and does not understand that err.status must be a valid property.\r\n\n\n### 🙂 Expected behavior\n\nNo compiler error.\r\n\n\n### Additional information about the issue\n\n_No response_","author":{"url":"https://github.com/LeviticusMB","@type":"Person","name":"LeviticusMB"},"datePublished":"2023-08-16T11:16:03Z","url":"https://github.com/microsoft/TypeScript/issues/55395"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:92a5176c-8dad-3fa2-1bd3-62e31ffefed4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D644:1D20B7:1907584:1FABDC0:6B017E3F |
| html-safe-nonce | 22da8ef96ac2cb115e26edfcdf4a671ccf917f1d4e41cc05e1b1855daa05146b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENjQ0OjFEMjBCNzoxOTA3NTg0OjFGQUJEQzA6NkIwMTdFM0YiLCJ2aXNpdG9yX2lkIjoiNjY0NjE0MzMzODkyNTg4Mjk0MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 510fc026be0e944c608cb90529b01061341537eb55438a2899154746312897eb |
| hovercard-subject-tag | issue:1853025050 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/55395/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ec4ba81c4af78ee57e2b510265d6dbb9440c7e6d3381205d83e4612f011ab782/microsoft/TypeScript/issues/55395 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ec4ba81c4af78ee57e2b510265d6dbb9440c7e6d3381205d83e4612f011ab782/microsoft/TypeScript/issues/55395 |
| og:image:alt | 🔎 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 t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | LeviticusMB |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width