Title: Control flow analysis based on operators applied to an argument · Issue #15196 · microsoft/TypeScript · GitHub
Open Graph Title: Control flow analysis based on operators applied to an argument · Issue #15196 · microsoft/TypeScript
X Title: Control flow analysis based on operators applied to an argument · Issue #15196 · microsoft/TypeScript
Description: TypeScript Version: 2.2.1 / Code function foo(a) { return a * 2 } foo(''); // Flow throws an error but TypeScript marked foo as foo(a:a ny): number; Expected behavior: a is type number Actual behavior: a is type any Try in Flow REPL Try ...
Open Graph Description: TypeScript Version: 2.2.1 / Code function foo(a) { return a * 2 } foo(''); // Flow throws an error but TypeScript marked foo as foo(a:a ny): number; Expected behavior: a is type number Actual behav...
X Description: TypeScript Version: 2.2.1 / Code function foo(a) { return a * 2 } foo(''); // Flow throws an error but TypeScript marked foo as foo(a:a ny): number; Expected behavior: a is type number Actu...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/15196
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Control flow analysis based on operators applied to an argument","articleBody":"**TypeScript Version:** 2.2.1 /\r\n\r\n**Code**\r\n\r\n```ts\r\nfunction foo(a) {\r\n return a * 2\r\n}\r\n\r\nfoo(''); // Flow throws an error but TypeScript marked foo as foo(a:a ny): number;\r\n```\r\n\r\n**Expected behavior:**\r\n`a` is type `number`\r\n**Actual behavior:**\r\n`a` is type `any`\r\n\r\n[Try in Flow REPL](https://flow.org/try/#0GYVwdgxgLglg9mABMOcAUBDAlIg3gKEUQCcBTKEYpDRAKkQCZ8BfffFdAck6yA)\r\n\r\n[Try in TypeScript REPLE](http://www.typescriptlang.org/play/index.html#src=function%20foo(a)%20%7B%20return%20a%20*%202%20%7D%0A%0Afoo(''))","author":{"url":"https://github.com/mohsen1","@type":"Person","name":"mohsen1"},"datePublished":"2017-04-14T18:03:03Z","url":"https://github.com/microsoft/TypeScript/issues/15196"}
| 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:6d868cf8-1f7c-a5b2-a8b7-519a56092e34 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9B5A:24ACB9:B9D4B7:F68C3A:6B00ED3A |
| html-safe-nonce | 60a524f961a9c8d9199fdfab8ff3d672787350f481d1cc285ea79e75b5806fd6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QjVBOjI0QUNCOTpCOUQ0Qjc6RjY4QzNBOjZCMDBFRDNBIiwidmlzaXRvcl9pZCI6Ijg1NzQ4MTQzNTA0MDgyMTU4NjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7471587acbc81241e81df50f5ca9247b0a7ddfa8e458626d893d1a79d0a2fd59 |
| hovercard-subject-tag | issue:221859120 |
| 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/15196/issue_layout |
| twitter:image | https://opengraph.githubassets.com/133147bc4ef2623282386947d863e9c05eb491e67bd2e7fc668794e78c0bc379/microsoft/TypeScript/issues/15196 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/133147bc4ef2623282386947d863e9c05eb491e67bd2e7fc668794e78c0bc379/microsoft/TypeScript/issues/15196 |
| og:image:alt | TypeScript Version: 2.2.1 / Code function foo(a) { return a * 2 } foo(''); // Flow throws an error but TypeScript marked foo as foo(a:a ny): number; Expected behavior: a is type number Actual behav... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mohsen1 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| 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 | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width