Title: Combining types broken? · Issue #19043 · microsoft/TypeScript · GitHub
Open Graph Title: Combining types broken? · Issue #19043 · microsoft/TypeScript
X Title: Combining types broken? · Issue #19043 · microsoft/TypeScript
Description: TypeScript Version: 2.5.3+ TSC works as expected in 2.5.2, unexpected behavior seen in 2.5.3 and @next (typescript@2.6.0-dev.20171007) Code type B = {b: string} const flowtypes = (b: B) => { type Combined = A & B const combined = (fn:...
Open Graph Description: TypeScript Version: 2.5.3+ TSC works as expected in 2.5.2, unexpected behavior seen in 2.5.3 and @next (typescript@2.6.0-dev.20171007) Code type B = {b: string} const flowtypes = (b: B) => { typ...
X Description: TypeScript Version: 2.5.3+ TSC works as expected in 2.5.2, unexpected behavior seen in 2.5.3 and @next (typescript@2.6.0-dev.20171007) Code type B = {b: string} const flowtypes = <A>(b: B) =&...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/19043
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Combining types broken?","articleBody":"\u003c!-- BUGS: Please use this template. -->\r\n\u003c!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript -->\r\n\u003c!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md -->\r\n\r\n**TypeScript Version:** 2.5.3+\r\nTSC works as expected in 2.5.2, unexpected behavior seen in 2.5.3 and @next (`typescript@2.6.0-dev.20171007`)\r\n\r\n**Code**\r\n\r\n```ts\r\ntype B = {b: string}\r\n\r\nconst flowtypes = \u003cA>(b: B) => {\r\n type Combined = A & B\r\n\r\n const combined = (fn: (combined: Combined) => void) => null\r\n const literal = (fn: (aPlusB: A & B) => void) => null\r\n\r\n return {combined, literal}\r\n}\r\n\r\nconst {combined, literal} = flowtypes\u003c{a: string}>({b: 'b-value'})\r\n\r\nliteral(aPlusB => {\r\n aPlusB.b\r\n aPlusB.a\r\n})\r\n\r\ncombined(comb => {\r\n comb.b\r\n comb.a\r\n})\r\n```\r\n\r\n**Expected behavior:**\r\nBoth `literal` and `combined` should produce the same behavior, and properties `a` and `b` should be accessible on the argument for both.\r\n\r\n**Actual behavior:**\r\n`comb.a` is unaccessible:\r\n`test.ts(21,8): error TS2339: Property 'a' does not exist on type 'Combined'.`","author":{"url":"https://github.com/garrettm","@type":"Person","name":"garrettm"},"datePublished":"2017-10-09T19:07:04Z","url":"https://github.com/microsoft/TypeScript/issues/19043"}
| 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:bb344490-b52a-ac5b-36f1-9f9ff0fd075e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 83C6:2679E9:9E9C32:D54E7C:6B00ECA8 |
| html-safe-nonce | 456df4ba66cfe7b5b16fb2689d372423d06a5adba631ef2f91a90e4c9b223154 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4M0M2OjI2NzlFOTo5RTlDMzI6RDU0RTdDOjZCMDBFQ0E4IiwidmlzaXRvcl9pZCI6IjgyODg2MDczMzMzNDk2NDk1NzYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1b6058607646381bf6118ea69c5f50e71a2d53d6b7971c664962bf20629c1e81 |
| hovercard-subject-tag | issue:263996410 |
| 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/19043/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a90ef12e3a7b2b7dedcf6f73823978072075199164af84cd740e174fff8d7881/microsoft/TypeScript/issues/19043 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a90ef12e3a7b2b7dedcf6f73823978072075199164af84cd740e174fff8d7881/microsoft/TypeScript/issues/19043 |
| og:image:alt | TypeScript Version: 2.5.3+ TSC works as expected in 2.5.2, unexpected behavior seen in 2.5.3 and @next (typescript@2.6.0-dev.20171007) Code type B = {b: string} const flowtypes = (b: B) => { typ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | garrettm |
| 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