Title: Design Meeting Notes, 7/17/2020 · Issue #39643 · microsoft/TypeScript · GitHub
Open Graph Title: Design Meeting Notes, 7/17/2020 · Issue #39643 · microsoft/TypeScript
X Title: Design Meeting Notes, 7/17/2020 · Issue #39643 · microsoft/TypeScript
Description: Falsey
Open Graph Description: Falsey
X Description: Falsey<any> -> any, Falsey<unknown> -> unknown #39529 function isThing(param: unknown): boolean { return param && typeof param === "object"; } Basically this sor...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/39643
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Design Meeting Notes, 7/17/2020","articleBody":"# `Falsey\u003cany>` -> `any`, `Falsey\u003cunknown>` -> `unknown`\r\n\r\nhttps://github.com/microsoft/TypeScript/pull/39529\r\n\r\n```ts\r\nfunction isThing(param: unknown): boolean {\r\n return param && typeof param === \"object\";\r\n}\r\n```\r\n\r\n* Basically this sort of thing is unsafe because `unknown` could be a `string` or whatever.\r\n* Ends up affecting lots of truthiness checks.\r\n* Also not exactly clear when you end up with `unknown` is not assignable to `Whatever`\r\n * But you already get this sort of behavior for if `param` was typed initially as `string` or `number`.\r\n* Does this happen only in strict mode? Or in all modes?\r\n * In non-strict mode we just take the right side of the expression; in strict mode, you get the error.\r\n* So we have some concerns about the error, but this seems like the right behavior.\r\n* It's a breaking change, so 4.1 bound.\r\n* But happening!\r\n\r\n# More Accurate Checks in Conditional Types\r\n\r\nhttps://github.com/microsoft/TypeScript/pull/39577\r\n\r\n* In conditional types, we decide whether to \"evaluate\" the conditional type based on whether the most restrictive and least restrictive instantiations will succeed and not succeed.\r\n* But the way we track that is wrong because it compares with respect to the \"wrong\" container types.\r\n* PR reintroduces a \"definitely assignable\" relationship.\r\n * Simplifies our codebase quite a bit.\r\n* 2.5% increase in compiling material-ui\r\n * That codebase is a stress-tester for regressions on type relationship checking.\r\n* We've had 9 releases where the current behavior has shipped until anyone realized.\r\n * Is the slowdown worth it?\r\n* PR has a suggestion for a layered cache. Suggestion had no meaningful speedups. What about #37810?\r\n * Didn't have any effect on material-ui, but was pretty nice on our compiler-with-union-nodes codebase.\r\n * Maybe combined they could work better?\r\n* Note, MUI is not an outlier, it's representative of the React community.\r\n * The patterns around CSS properties.\r\n * Anything that uses styled components might see the same regressions.\r\n* Revisit towards 4.1 timeframe. Could affect a lot of people, don't want to be risky.\r\n\r\n\r\n# Quoted vs Unquoted Numerically Named Keys in Declaration Files\r\n\r\nhttps://github.com/microsoft/TypeScript/issues/37292\r\n\r\n```ts\r\nclass C {\r\n readonly lines = {\r\n '1': 'abc',\r\n };\r\n}\r\n```\r\n\r\n* What should `keyof C['lines']` be?\r\n * When we see the numerically named property, we say that it can be `1` or `\"1\"`.\r\n * When we print this as a `.d.ts`, we only printed out the string representation.\r\n* PR ensures the numeric keys are present.\r\n* Will this cause big problems with `Exclude` and `Omit`?\r\n * What would you be excluding? `\"0\"`? `\"1\"`?\r\n* Things that expect `string`s and someone wrote an incorrect `Object.keys`.\r\n* Didn't see any code getting broken, but might not have enough tests.\r\n* If your intent is to get only strings or whatever, you can use `Extract\u003ckeyof T, string>` or `(keyof T) & string`.\r\n* Conclusion: keep exploring here.\r\n\r\n# Supporting Types in the npm CLI\r\n\r\nhttps://github.com/npm/read-package-json/pull/92/\r\n\r\n* npm has an RFC process\r\n * Have one for adding type information to the npm registry.\r\n * Make it unambiguous on the registry as to whether a package includes types.\r\n* Have a PR on the npm CLI to stamp whether there's a TS or Flow types file \"on the way up\" when publishing.\r\n* Yarn's search currently indicates whether packages are typed - npm's search does not. This would allow the npm search to work better.\r\n* Why can't npm's search figure this stuff out on its own?\r\n * Yarn uses Algolia to figure things out, does local file system access.\r\n* How does the `exports` list work?\r\n * This is the new \"multi-main package\" field that can support ES modules.\r\n * https://nodejs.org/api/esm.html#esm_exports_sugar\r\n * Unclear if there are issues yet.","author":{"url":"https://github.com/DanielRosenwasser","@type":"Person","name":"DanielRosenwasser"},"datePublished":"2020-07-17T20:03:44Z","url":"https://github.com/microsoft/TypeScript/issues/39643"}
| 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:bd4c4937-3b79-25b3-21af-309366617163 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E7F4:363D8E:2937B61:3446102:6B018957 |
| html-safe-nonce | cc4a366f63fdb87b1b372d8e7a5e206a759cbdef434948409e963230dcf8c481 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFN0Y0OjM2M0Q4RToyOTM3QjYxOjM0NDYxMDI6NkIwMTg5NTciLCJ2aXNpdG9yX2lkIjoiMTEwNTQ1NTU2Nzk1NjE4MzM4MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c88020d378bfdd2b790558eb35548f09b5a1b67b5aa45d3bbc9b437fe90dda78 |
| hovercard-subject-tag | issue:659590675 |
| 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/39643/issue_layout |
| twitter:image | https://opengraph.githubassets.com/31fb2729120a5af38fbfbf0877de6d7ecc7be16a4d191d818cadb25d1441bcde/microsoft/TypeScript/issues/39643 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/31fb2729120a5af38fbfbf0877de6d7ecc7be16a4d191d818cadb25d1441bcde/microsoft/TypeScript/issues/39643 |
| og:image:alt | Falsey |
| 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 | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width