Title: allow narrowing from any · Issue #9999 · microsoft/TypeScript · GitHub
Open Graph Title: allow narrowing from any · Issue #9999 · microsoft/TypeScript
X Title: allow narrowing from any · Issue #9999 · microsoft/TypeScript
Description: There are numerous questions as to why any cannot be narrowed from. Despite being natural and intuitive this feature was rejected due to being a serious breaking change to poorly written yet massive code bases. Please consider putting it...
Open Graph Description: There are numerous questions as to why any cannot be narrowed from. Despite being natural and intuitive this feature was rejected due to being a serious breaking change to poorly written yet massiv...
X Description: There are numerous questions as to why any cannot be narrowed from. Despite being natural and intuitive this feature was rejected due to being a serious breaking change to poorly written yet massiv...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/9999
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"allow narrowing from any","articleBody":"There are numerous questions as to why `any` cannot be narrowed from. Despite being natural and intuitive this feature was rejected due to being a serious breaking change to poorly written yet massive code bases.\n\nPlease consider putting it behind a flag provided the evident need for it.\n\n**TLDR**\n- `any` is not what you think it is (poor naming at play)\n- for narrowing use `type unknown = {} | undefined | null | void` instead\n- yes, it's a hot unfortunate mess\n- no, there is no painless way to fix it\n- yes, you gonna need to fix your `*.d.ts` by hands\n- why? to make average JS developers happy with their less than perfect code\n- welcome to the club! get your badge at the reception\n\n**UPDATE**\n@yortus made a branch per https://github.com/Microsoft/TypeScript/issues/9999#issuecomment-238070961 where **narrowing from `any` works!**\n\ntry it: `npm install typescript-narrowany`\n","author":{"url":"https://github.com/zpdDG4gta8XKpMCd","@type":"Person","name":"zpdDG4gta8XKpMCd"},"datePublished":"2016-07-28T01:47:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":120},"url":"https://github.com/9999/TypeScript/issues/9999"}
| 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:ad747061-3b82-105e-a40c-066015ab1435 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B9D0:2088C9:12FFE62:1972A63:6A62CD08 |
| html-safe-nonce | 36ba1c64a66fb166be6cc381983465c9dd523e8e1e82ac477f5c001147b4ec80 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOUQwOjIwODhDOToxMkZGRTYyOjE5NzJBNjM6NkE2MkNEMDgiLCJ2aXNpdG9yX2lkIjoiODg0NDM0NjI2NzQ4MjcxODgwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f108845627b279672180fb36b14e1bf34fa0634c9e5dfa9e524e9e2440145d83 |
| hovercard-subject-tag | issue:167995363 |
| 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/9999/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3659443d8c65825b0728c15f98925e76c6e6c558ab9a5eb7c271ede4c5f67372/microsoft/TypeScript/issues/9999 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3659443d8c65825b0728c15f98925e76c6e6c558ab9a5eb7c271ede4c5f67372/microsoft/TypeScript/issues/9999 |
| og:image:alt | There are numerous questions as to why any cannot be narrowed from. Despite being natural and intuitive this feature was rejected due to being a serious breaking change to poorly written yet massiv... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zpdDG4gta8XKpMCd |
| hostname | github.com |
| expected-hostname | github.com |
| None | df33b1b61ee7b9a0af988199bfc3503c9c1acafb1f1d40e1f140ea7c84f890dd |
| 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 | d41cd1bdb290013455c0ac430fa755621733f5eb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width