Title: Generic type argument cannot be inferred by nested callback return type · Issue #9660 · microsoft/TypeScript · GitHub
Open Graph Title: Generic type argument cannot be inferred by nested callback return type · Issue #9660 · microsoft/TypeScript
X Title: Generic type argument cannot be inferred by nested callback return type · Issue #9660 · microsoft/TypeScript
Description: TypeScript Version: 1.8.10 Code declare function a
Open Graph Description: TypeScript Version: 1.8.10 Code declare function a
X Description: TypeScript Version: 1.8.10 Code declare function a<T>(f: (x: T) => ((y: T) => T)): T; a<number>(x => y => 1); // works a(x => y => 1); // infers T as { } a<string&g...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/9660
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Generic type argument cannot be inferred by nested callback return type","articleBody":"**TypeScript Version:** 1.8.10\n\n**Code**\n\n``` ts\ndeclare function a\u003cT>(f: (x: T) => ((y: T) => T)): T;\n\na\u003cnumber>(x => y => 1); // works\na(x => y => 1); // infers T as { }\na\u003cstring>(x => y => 1); // error, as expected\n```\n\n**Expected behavior:**\nIn `a(x => y => 1)`, `T` is inferred as `number` based on nested callback return type.\nAs shows `a\u003cstring>(x => y => 1)` example, the just cannot be anything else.\n\n**Actual behavior:** \nIn `a(x => y => 1)`, `T` is inferred as `{ }`.\n","author":{"url":"https://github.com/Igorbek","@type":"Person","name":"Igorbek"},"datePublished":"2016-07-13T06:34:22Z","url":"https://github.com/microsoft/TypeScript/issues/9660"}
| 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:f4d12d0b-0b8b-a821-ed8f-9e48b6290915 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CB60:291B58:F5F3C:136B0C:6B00F7EF |
| html-safe-nonce | bd8b7be2ea6d3772bda2a0774a26c7d700aa246275792ea88cb7e8af44d1523b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjYwOjI5MUI1ODpGNUYzQzoxMzZCMEM6NkIwMEY3RUYiLCJ2aXNpdG9yX2lkIjoiNTI5MjQ2MzMyMDQ2MzM3NDMxOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e92021aab4a408d0ce5e56fe1222f37fc4db895d419abc8fbfe3e0b7d11c8def |
| hovercard-subject-tag | issue:165247498 |
| 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/9660/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e713e3601159bb8509ab0fcbfc842577965f45cc516e86b49f3e18102c49126e/microsoft/TypeScript/issues/9660 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e713e3601159bb8509ab0fcbfc842577965f45cc516e86b49f3e18102c49126e/microsoft/TypeScript/issues/9660 |
| og:image:alt | TypeScript Version: 1.8.10 Code declare function a |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Igorbek |
| hostname | github.com |
| expected-hostname | github.com |
| None | e208d86428ec00a57ade75058166297440e8128a01e5287c31a53dc042bbf187 |
| 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 | 7dafd017fb7809a839c443dba08622af38e63c09 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width