Title: Design Meeting Notes, 12/1/2017 · Issue #20398 · microsoft/TypeScript · GitHub
Open Graph Title: Design Meeting Notes, 12/1/2017 · Issue #20398 · microsoft/TypeScript
X Title: Design Meeting Notes, 12/1/2017 · Issue #20398 · microsoft/TypeScript
Description: Partial generic type arguments #10571 Partial inference for generic type arguments Today we either infer all or none Gets a little bit confusing for defaults Today, if you have a parameter list like in f
Open Graph Description: Partial generic type arguments #10571 Partial inference for generic type arguments Today we either infer all or none Gets a little bit confusing for defaults Today, if you have a parameter list lik...
X Description: Partial generic type arguments #10571 Partial inference for generic type arguments Today we either infer all or none Gets a little bit confusing for defaults Today, if you have a parameter list lik...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/20398
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Design Meeting Notes, 12/1/2017","articleBody":"# Partial generic type arguments\r\n\r\n#10571\r\n\r\n* Partial inference for generic type arguments\r\n * Today we either infer all or none\r\n* Gets a little bit confusing for defaults\r\n * [Today](http://www.typescriptlang.org/play/index.html#src=declare%20function%20f%3CT%2C%20U%2C%20V%20%3D%20never%3E(x%3A%20T%2C%20y%3A%20U%2C%20z%3A%20V)%3A%20void%3B%0D%0A%0D%0Af%3Cstring%2C%20boolean%3E(%22%22%2C%20true%2C%20100)), if you have a parameter list like in `f\u003cT, U, V = never>(x: T, y: U, z: V): void`, a type argument list like in `f\u003cstring, boolean>(\"\", true, 100)` will infer `never` for `V` and cause an error.\r\n * `Argument of type '100' is not assignable to parameter of type 'never'.`\r\n* This would technically be a breaking change.\r\n * But might be hard to actually encounter.\r\n * Though, type parameter defaults with `any` might be a case.\r\n* So idea: always do inference, and maybe do an optimization when all type parameters are \"fixed\".\r\n* Should you be able to mix positional/named?\r\n * Either\r\n * Only positional & only named\r\n * Positional followed by named\r\n\r\n#19205\r\n\r\n* Comes up with Vue's `\u003cData, Computed, Methods, PropNames>`\r\n * Want to be able to add `Props`, but it comes last.\r\n * Even if it didn't come last, people want to be able to specify these.\r\n * By the time you have 5 type arguments, you really won't be able to reason these.\r\n* Do we want to do this even if associated types might be another option?\r\n * Seems like we could still do this and tackle associated types later.\r\n* Syntax\r\n * Technically an invalid left-hand side, should be fine.\r\n\r\n## Conclusions\r\n\r\n* Partial inference\r\n * Do it, infer in place of default arguments, and continue to use the default when no inferences are available.\r\n* Named type parameters\r\n * Positional followed by named\r\n\r\n# Extracting returned/constructed types\r\n\r\n#6606\r\n#20350\r\n\r\n* Undergoing overload resolution is problematic.\r\n * Implementation is super complex and you run into several circularity problems.\r\n* Could just give the union, but what abut type parameters?\r\n* What about the \"zero-order\" problem? In other words, no overloads.\r\n * This is one of the most common cases.\r\n* Does this solve things cases like promisify?\r\n * No, you need variadic kinds.\r\n* Would match types take care of this?\r\n * They wouldn't be able to decompose overloads.\r\n* What about a zero-order `typeof`?\r\n * What does that even mean?\r\n* How's this different from `const x: typeof x`?\r\n * We can short-circuit more easily based on the symbol thanks to the restricted forms.","author":{"url":"https://github.com/DanielRosenwasser","@type":"Person","name":"DanielRosenwasser"},"datePublished":"2017-12-01T20:12:04Z","url":"https://github.com/microsoft/TypeScript/issues/20398"}
| 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:fc9b69bc-c293-f61b-3aa3-5b729923dd2e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C886:363D8E:2F78639:3C3665C:6B01ABA0 |
| html-safe-nonce | 0c0abcc962d4f78b02350082897779c1fc0b90a24968ca5208dbb16f68fa76db |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODg2OjM2M0Q4RToyRjc4NjM5OjNDMzY2NUM6NkIwMUFCQTAiLCJ2aXNpdG9yX2lkIjoiNDU0MDA1OTg0Mjc2NDcxMjg2NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7bf73441fb8c71f57b66954d89799b70be22992c37169f5d04bc97fd9135cf3c |
| hovercard-subject-tag | issue:278582670 |
| 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/20398/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2f32bbcfb8a35fd187f6c8dea45d286290faab38449484c2fd6f20beb54beabb/microsoft/TypeScript/issues/20398 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2f32bbcfb8a35fd187f6c8dea45d286290faab38449484c2fd6f20beb54beabb/microsoft/TypeScript/issues/20398 |
| og:image:alt | Partial generic type arguments #10571 Partial inference for generic type arguments Today we either infer all or none Gets a little bit confusing for defaults Today, if you have a parameter list lik... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DanielRosenwasser |
| 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