Title: Design Meeting Notes, 6/9/2017 · Issue #16415 · microsoft/TypeScript · GitHub
Open Graph Title: Design Meeting Notes, 6/9/2017 · Issue #16415 · microsoft/TypeScript
X Title: Design Meeting Notes, 6/9/2017 · Issue #16415 · microsoft/TypeScript
Description: Stricter generic signature checks Already did some work in #16072 to perfom type argument inference using the return type of a signature as a target. In #16305 we added support for signatures to gain type parameters from their contextual...
Open Graph Description: Stricter generic signature checks Already did some work in #16072 to perfom type argument inference using the return type of a signature as a target. In #16305 we added support for signatures to ga...
X Description: Stricter generic signature checks Already did some work in #16072 to perfom type argument inference using the return type of a signature as a target. In #16305 we added support for signatures to ga...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/16415
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Design Meeting Notes, 6/9/2017","articleBody":"# Stricter generic signature checks\r\n\r\n* Already did some work in #16072 to perfom type argument inference using the return type of a signature as a target.\r\n* In #16305 we added support for signatures to *gain* type parameters from their contextual types.\r\n * This behavior is more appropriate because it respects the constraints and the universality of each usage of type parameters.\r\n* To follow up with this, we're introducing stricter generic signature checks (#16368).\r\n * Previously, when *relating* type parameters, we would erase them with the type `any`.\r\n * This was fairly unsafe.\r\n * Previously the following would work, but with #16368, the following is an error.\r\n ```ts\r\n type A = \u003cT, U>(x: T, y: U) => [T, U];\r\n type B = \u003cS>(x: S, y: S) => [S, S];\r\n\r\n function f(a: A, b: B) {\r\n a = b; // Error\r\n b = a; // Ok\r\n }\r\n ```\r\n * This is kind of a form of unification between the two parameters.\r\n * We infer using the type parameters of the target, as if we were calling the source with the target's parameters.\r\n * In other words, in `a = b` above, it simulates calling `b` with `a`'s parameters.\r\n * The caveat is that this logic is only applied to single-signature types.\r\n * Any times you have overloads, it becomes extremely difficult to perform these checks.\r\n* So the question is: do we put this behind a flag?\r\n * Most errors are good, but it's hard to figure out what to do for some advanced scenarios.\r\n * Get it into `master` and see what we can work with.\r\n\r\n# Private Slots\r\n\r\nProposal: https://github.com/tc39/proposal-private-fields/ ([Permalink](https://github.com/tc39/proposal-private-fields/tree/e4c2dac915698db11f386ca85a13df3e3d67a9d0))\r\n\r\nRepo: https://tc39.github.io/proposal-private-fields/\r\n\r\n* How does this work with existing modifiers?\r\n * See https://github.com/Microsoft/TypeScript/issues/16324#issuecomment-306890149\r\n\r\n* Can we offer a true downlevel translation?\r\n * To ES5?\r\n * No.\r\n * Need weakmaps\r\n * Yes above ES6.\r\n* Could give a mangled name in ES5/ES3.\r\n * Has potential problems.\r\n * Proxies, enumeration, etc.\r\n * Proxies and the like don't exist in ES5.\r\n * Best effort might be fine.\r\n* What about using Symbols in ES6?\r\n * Symbols aren't truly private - can be used by proxies, can be iterated over, etc.\r\n* Weakmaps make it truly private.\r\n * Are they performant?\r\n * Concerns over the type of GC pressure it may cause.\r\n * Edge is good at this!\r\n * Implementation is that every object has a list of weakmaps so that the lookup is inverted.\r\n * Others not as much at this point in time.\r\n * But will eventually improve!\r\n * But it's all opt-in.\r\n * Is it possible that all users really want is design-time private?\r\n * There are definitely people who've wanted private state.\r\n\r\n* P.S. ~~everyone hates the syntax.~~ we're not big on the syntax\r\n\r\n* Completely unrelated\r\n * The proposal breaks JScript 5.8 in IE 8.\r\n * ¯\\\\\\_(ツ)\\_/¯\r\n\r\n* We'll all need to go over the FAQ more closely on the private state proposal repo.\r\n * https://github.com/tc39/proposal-private-fields/blob/master/FAQ.md\r\n","author":{"url":"https://github.com/DanielRosenwasser","@type":"Person","name":"DanielRosenwasser"},"datePublished":"2017-06-09T20:34:59Z","url":"https://github.com/microsoft/TypeScript/issues/16415"}
| 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:e640c8fb-3451-256f-412a-660fb41f2767 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AABA:3D4705:968BF0:C387A6:6B00DF2A |
| html-safe-nonce | 2e28c8e6f29b666a11133dd757e136199dc3ecc7e084664438d4a72c80647658 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQUJBOjNENDcwNTo5NjhCRjA6QzM4N0E2OjZCMDBERjJBIiwidmlzaXRvcl9pZCI6IjcyMDMxMDk2NzI3NTkzODU4OTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cfda666d2efddf1c35154d6453ccf5df5c13aa12cfa736f8864702105495efd9 |
| hovercard-subject-tag | issue:234932435 |
| 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/16415/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4515d60103e2abdf29ea76c0e1fe95b916040a144636e53920ffc1d1a6080128/microsoft/TypeScript/issues/16415 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4515d60103e2abdf29ea76c0e1fe95b916040a144636e53920ffc1d1a6080128/microsoft/TypeScript/issues/16415 |
| og:image:alt | Stricter generic signature checks Already did some work in #16072 to perfom type argument inference using the return type of a signature as a target. In #16305 we added support for signatures to ga... |
| 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 | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| 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 | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width