Title: Design Meeting Notes, 2/16/2018 · Issue #22011 · microsoft/TypeScript · GitHub
Open Graph Title: Design Meeting Notes, 2/16/2018 · Issue #22011 · microsoft/TypeScript
X Title: Design Meeting Notes, 2/16/2018 · Issue #22011 · microsoft/TypeScript
Description: Recursive Conditional Types #21316 (comment) @tycho01 already reiterated we have recursive conditional types with indexed access types on object types (#21613 (comment)) Well damn it, if you can already do it with object types, why make ...
Open Graph Description: Recursive Conditional Types #21316 (comment) @tycho01 already reiterated we have recursive conditional types with indexed access types on object types (#21613 (comment)) Well damn it, if you can al...
X Description: Recursive Conditional Types #21316 (comment) @tycho01 already reiterated we have recursive conditional types with indexed access types on object types (#21613 (comment)) Well damn it, if you can al...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/22011
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Design Meeting Notes, 2/16/2018","articleBody":"# Recursive Conditional Types\r\n\r\nhttps://github.com/Microsoft/TypeScript/pull/21316#issuecomment-359275993\r\n\r\n* @tycho01 already reiterated we have recursive conditional types with indexed access types on object types (https://github.com/Microsoft/TypeScript/pull/21613#issuecomment-365774702)\r\n * Well damn it, if you can already do it with object types, why make it ugly to do with regular conditional types?\r\n* Conditional types contain 4 types\r\n * The checked type, the extends type, the true type, and the false type\r\n * When the condition is *definitely* true or false, we do an immediate instantiation (/evaluation) of the respective branch\r\n * Those branches are already sort of deferral points, much like the object member types.\r\n * If an conditional type is instantiated over 100 times, we consider that to be too deep.\r\n * At that point, we try to find the respective alias type that contains that conditional type.\r\n* *\\[\\[Demonstration of Peano-style arithmetic with multiplication]]*\r\n* Challenges\r\n 1. The \"we've instantiated too deeply\" error is issued on the declaration instead of the usage, which is not totally obvious.\r\n 2. The act of checking whether a type satisfies a constraint in a conditional type (e.g. seeing if `A` is assignable to `B` in `A extends B`) requires evaluating `A`.\r\n * That means if `A` is a conditional type, either branch needs to be evaluated immediately to see if it satisfies `B`. That means you can end up exhausting your instantiation stack.\r\n* Question: Why not defer the type when comparing a conditional to the constraint type.\r\n * doesn't make sense, you need to check *now*\r\n * you could imagine that our compiler architecture was more deferred, but that would make it much harder to reason about.\r\n* Question: *or*, when you hit the limit, stop evaluating once you hit the limit and defer the evaluation?\r\n* Also, this instantiation stack limit is quite annoying: you can get errors on unrelated type aliases.\r\n * What if your stack is tied per type instantiation?\r\n * Or rather than per type, you use the global stack but check specific types in that stack.\r\n* Conclusion: give users an error in these situations, try to improve the message.\r\n\r\n# Ignore specific errors with `@ts-ignore` comments\r\n\r\nIssue: #19139\r\nPR: #21602\r\n\r\n* Given the error code, what are you actually suppressing?\r\n * Seems entirely unclear.\r\n * Error codes don't tell you what you're doing\r\n * Short-names are better than numbers.\r\n* So short names?\r\n * But this gives a bad UX; way more on the screen than you wanted.\r\n * Also, people are *probably* relying on the error codes even though they shouldn't be!!\r\n * What if we gave short codes in `--pretty`?\r\n* Could give quick info for the error code.\r\n * Great but how does that help you on a code review on GitHub?\r\n * Why, do you inherently distrust the code you're reviewing?\r\n * Sometimes yes?\r\n* A lot of these are to suppress lint rules.\r\n * Maybe the solution is just to get out of the linting business. :)\r\n* What if these comments caused errors when no error's present on the next line?\r\n * We might feel better about that.\r\n * Half jokingly: Can you suppress *those* errors?\r\n * Now the idea has become a half-joke.\r\n* Conclusion: no conclusion *yet*.\r\n* Post-design meeting realization: original motivation was mass suppression for working code.\r\n * Seems more reasonable with that in mind.","author":{"url":"https://github.com/DanielRosenwasser","@type":"Person","name":"DanielRosenwasser"},"datePublished":"2018-02-17T07:43:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/22011/TypeScript/issues/22011"}
| 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:3d2f9af6-c563-9d71-60a9-2ebb6311a529 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D5A:1893D6:5E3EDC:7EFEED:6A62D9FC |
| html-safe-nonce | 94142b21938d35657b9e3b2eaa21d2bd77571c0857f0a33e7b2753813b43faa6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDVBOjE4OTNENjo1RTNFREM6N0VGRUVEOjZBNjJEOUZDIiwidmlzaXRvcl9pZCI6IjI2ODExODc4MTc5NzMwMTI5ODgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3ee7cbdbc6e1716c6a717d820b91cc668be4ac482d1f47acd172b03a64d03318 |
| hovercard-subject-tag | issue:297987197 |
| 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/22011/issue_layout |
| twitter:image | https://opengraph.githubassets.com/87679524934d9c44c7b18de9e334b1fb0dd925f15159fb56adb14b7d325d98ab/microsoft/TypeScript/issues/22011 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/87679524934d9c44c7b18de9e334b1fb0dd925f15159fb56adb14b7d325d98ab/microsoft/TypeScript/issues/22011 |
| og:image:alt | Recursive Conditional Types #21316 (comment) @tycho01 already reiterated we have recursive conditional types with indexed access types on object types (#21613 (comment)) Well damn it, if you can al... |
| 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 | df33b1b61ee7b9a0af988199bfc3503c9c1acafb1f1d40e1f140ea7c84f890dd |
| 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 | d41cd1bdb290013455c0ac430fa755621733f5eb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width