Title: Type guard handling with boolean compares · Issue #9508 · microsoft/TypeScript · GitHub
Open Graph Title: Type guard handling with boolean compares · Issue #9508 · microsoft/TypeScript
X Title: Type guard handling with boolean compares · Issue #9508 · microsoft/TypeScript
Description: TypeScript Version: 1.8.0 Code let myAny: Array
Open Graph Description: TypeScript Version: 1.8.0 Code let myAny: Array
X Description: TypeScript Version: 1.8.0 Code let myAny: Array<string> | string; myAny = 'anythinghere'; if (Array.isArray(myAny)) { let narrowed = myAny; } if (!!Array.isArray(myAny)) { let narrowe...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/9508
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Type guard handling with boolean compares","articleBody":"**TypeScript Version:** 1.8.0\n\n**Code**\n\n``` ts\nlet myAny: Array\u003cstring> | string;\nmyAny = 'anythinghere';\n\nif (Array.isArray(myAny)) {\n let narrowed = myAny;\n}\n\nif (!!Array.isArray(myAny)) {\n let narrowed = myAny;\n}\n\nif (Array.isArray(myAny) === true) {\n let notNarrowed = myAny;\n}\n```\n\n**Expected behavior:**\nAll three should result in the same type guard.\nTested with Visual Studio 2015 Update 2 and TypeScript Playground mouse hover.\n","author":{"url":"https://github.com/HolgerJeromin","@type":"Person","name":"HolgerJeromin"},"datePublished":"2016-07-04T13:07:15Z","url":"https://github.com/microsoft/TypeScript/issues/9508"}
| 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:ce036d6d-a601-0403-4a84-fda841c57d4e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D748:1087D4:1FC2CF5:2A68965:6B018111 |
| html-safe-nonce | abbdfc8724dc173b4e4a938a4291f91cd8aad63bd46e24728952ff36e9489552 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzQ4OjEwODdENDoxRkMyQ0Y1OjJBNjg5NjU6NkIwMTgxMTEiLCJ2aXNpdG9yX2lkIjoiMzk3MjY1NDUxNzkwMzc4NjI1NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1b7463e365b0707a42f8068657b1fb70a9b1f9652901b5ed82b2096860a8797e |
| hovercard-subject-tag | issue:163673402 |
| 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/9508/issue_layout |
| twitter:image | https://opengraph.githubassets.com/db4724419e19abdbc4d360ec4aee8e0bdcdffbff407a695e7a2026d02b851f38/microsoft/TypeScript/issues/9508 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/db4724419e19abdbc4d360ec4aee8e0bdcdffbff407a695e7a2026d02b851f38/microsoft/TypeScript/issues/9508 |
| og:image:alt | TypeScript Version: 1.8.0 Code let myAny: Array |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | HolgerJeromin |
| 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