Title: Type Guards no longer work inside a nested closure. · Issue #8552 · microsoft/TypeScript · GitHub
Open Graph Title: Type Guards no longer work inside a nested closure. · Issue #8552 · microsoft/TypeScript
X Title: Type Guards no longer work inside a nested closure. · Issue #8552 · microsoft/TypeScript
Description: TypeScript Version: nightly (1.9.0-dev.20160217) Code interface TypeGuard { guard: boolean; } function isTypeGuard(value: any): value is TypeGuard { return value.guard; } let a: { notGuard: boolean } | TypeGuard; if (isTypeGuard(a)) { co...
Open Graph Description: TypeScript Version: nightly (1.9.0-dev.20160217) Code interface TypeGuard { guard: boolean; } function isTypeGuard(value: any): value is TypeGuard { return value.guard; } let a: { notGuard: boolean...
X Description: TypeScript Version: nightly (1.9.0-dev.20160217) Code interface TypeGuard { guard: boolean; } function isTypeGuard(value: any): value is TypeGuard { return value.guard; } let a: { notGuard: boolean...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/8552
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Type Guards no longer work inside a nested closure.","articleBody":"\u003c!--\nThank you for contributing to TypeScript! Please review this checklist\n before submitting your issue.\n[ ] Many common issues and suggestions are addressed in the FAQ\n https://github.com/Microsoft/TypeScript/wiki/FAQ\n[ ] Search for duplicates before logging new issues\n https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=is%3Aissue\n[ ] Questions are best asked and answered at Stack Overflow\n http://stackoverflow.com/questions/tagged/typescript\n\nFor bug reports, please include the information below.\n__________________________________________________________ -->\n\n**TypeScript Version:** \nnightly (1.9.0-dev.20160217)\n\n**Code**\n\n``` ts\ninterface TypeGuard {\n guard: boolean;\n}\nfunction isTypeGuard(value: any): value is TypeGuard {\n return value.guard;\n}\n\nlet a: { notGuard: boolean } | TypeGuard;\nif (isTypeGuard(a)) {\n const b: TypeGuard = a;\n let c: TypeGuard\n (() => c = a)();\n}\n```\n\n**Expected behavior:**\nThe guarded type should be guarded within any nested closures.\n\n**Actual behavior:** \nThe guarded type is not guarded in any nested closures. This has previously been working correctly.\n\nExample outputs...\n\n\n\n\n\nThis is impacting https://github.com/ReactiveX/rxjs/issues/1697\n\ncc @alexeagle\n","author":{"url":"https://github.com/david-driscoll","@type":"Person","name":"david-driscoll"},"datePublished":"2016-05-11T12:28:11Z","url":"https://github.com/microsoft/TypeScript/issues/8552"}
| 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:48c9ce78-000e-0f95-9f84-9a70f6209ffb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C43C:A71F9:228ADFC:2BAB886:6B01B4CA |
| html-safe-nonce | 9e8723b4fdd1cbe3854be0026094cea81beae5baf9a8314b7529eb8dce216e20 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNDNDOkE3MUY5OjIyOEFERkM6MkJBQjg4Njo2QjAxQjRDQSIsInZpc2l0b3JfaWQiOiIyMzA5MzE4MDMzNjY2MDE5MzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | bc9c256c1f9af9c92b2368bc1ad6d66b3d0bdb872932838902824ef578f5b9ae |
| hovercard-subject-tag | issue:154231351 |
| 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/8552/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2d4a815ee6964e27661e0d5938f01cf6becf34d2588662ff6340e97bbd0d5055/microsoft/TypeScript/issues/8552 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2d4a815ee6964e27661e0d5938f01cf6becf34d2588662ff6340e97bbd0d5055/microsoft/TypeScript/issues/8552 |
| og:image:alt | TypeScript Version: nightly (1.9.0-dev.20160217) Code interface TypeGuard { guard: boolean; } function isTypeGuard(value: any): value is TypeGuard { return value.guard; } let a: { notGuard: boolean... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | david-driscoll |
| 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