Title: Design Meeting Notes, 6/11/2024 · Issue #58918 · microsoft/TypeScript · GitHub
Open Graph Title: Design Meeting Notes, 6/11/2024 · Issue #58918 · microsoft/TypeScript
X Title: Design Meeting Notes, 6/11/2024 · Issue #58918 · microsoft/TypeScript
Description: Syntactic Form for Preserving Computed Property Names #58829 When you have isolatedDeclarations, you can't use computed property names in object literals and classes. They transform into different forms depending on the type (symbol, str...
Open Graph Description: Syntactic Form for Preserving Computed Property Names #58829 When you have isolatedDeclarations, you can't use computed property names in object literals and classes. They transform into different ...
X Description: Syntactic Form for Preserving Computed Property Names #58829 When you have isolatedDeclarations, you can't use computed property names in object literals and classes. They transform into differ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/58918
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Design Meeting Notes, 6/11/2024","articleBody":"# Syntactic Form for Preserving Computed Property Names\r\n\r\nhttps://github.com/microsoft/TypeScript/pull/58829\r\n\r\n* When you have `isolatedDeclarations`, you can't use computed property names in object literals and classes.\r\n * They transform into different forms depending on the type (symbol, string types, etc.).\r\n* We basically said they're not supported under `isolatedDeclarations`.\r\n* This proposal is to support computed property names under `isolatedDeclarations` by introducing a new syntactic form.\r\n\r\n ```ts\r\n export const obj = {\r\n [someValue satisfies keyof]: 123,\r\n };\r\n ```\r\n* Idea is this should be transformed into the following declaration file:\r\n\r\n ```ts\r\n export declare const obj: {\r\n [someValue]: number;\r\n };\r\n ```\r\n* Under this, `someValue` must be a singleton/unit type.\r\n* What is the specific use-case here?\r\n * Need to preserve the exact syntax input by the user - codebases with computed properties can't use `isolatedDeclarations`.\r\n* Do we really need new syntax for ID?\r\n* Why can't we just error in cases when an \"optimistic inference\" would not succeed?\r\n * We didn't feel okay doing optimistic inference in general.\r\n* Why can't we just emit the expression as-is always?\r\n * A computed property resolves differently depending on ambient vs. non-ambient contexts.\r\n * Also, we'd need to now preserve the declaration of more non-exported values.\r\n * We do that for `typeof` anyhow.\r\n * In general, it's a breaking change.\r\n\r\n# Only Look up `type` from `package.json` when in `node_modules` (and in `node16`)\r\n\r\nhttps://github.com/microsoft/TypeScript/pull/58825\r\n\r\n* Got feedback on a feature that we added in 5.5 where we look up `package.json`.\r\n* Two issues reported.\r\n * First: dual-publish. CJS and ESM.\r\n * Second: script file that really wasn't meant to be driven by a `package.json` farther up the spine.\r\n * Third: doing all this work causes a lot of file-watching.\r\n* A few options:\r\n * Revert all of this.\r\n * Only expand the behavior to modules inside of `node_modules`.\r\n * Roll with it.\r\n* How does it work with monorepos with symlinked dependencies in `node_modules`?\r\n * Seems like it plays \"correctly\" - we always go through `realpath` and figure out where the actual file is.\r\n\r\n# Analyze Control Flow Effects of Callbacks\r\n\r\nhttps://github.com/microsoft/TypeScript/pull/58729\r\n\r\n* Considered a strictness flag - but feels like maybe this should be the default.\r\n* Issues around the `Deferred` helper conflicting with libraries using this type.\r\n * Using a type helper probably communicates the wrong thing as ewll.\r\n* What's the work-around for when the caller doesn't mark something as `deferred`?\r\n * Define a helper function called `deferred` that just takes and returns the function.\r\n\r\n ```ts\r\n function deferred\u003cT extends (...args: any[]) =\u003e any\u003e(deferred fn: T): T {\r\n return fn;\r\n }\r\n ```\r\n* All the examples of new breaks running over GitHub are kind of expected - places where `deferred` will need to be added.\r\n * But which of these are wins?\r\n * Maybe the `tinacms` examples.\r\n * And Pyright has a missing non-null assertion.\r\n* What happens if you mark a parameter as `deferred` and it's not deferrable?\r\n * We could error on that.\r\n* Some have asked about why we only do this for function expressions and not declarations (or constants initialized to function expressions).\r\n * Easier to explain, visually shows up.\r\n * And it would be a *whole* lot more analysis.\r\n * And then issues around circularities due to resolving each name.\r\n* Does `deferred` affect assignability?\r\n * Right now we don't do anything special.\r\n * Currently it's an intrinsic type that doesn't affect assignability.\r\n","author":{"url":"https://github.com/DanielRosenwasser","@type":"Person","name":"DanielRosenwasser"},"datePublished":"2024-06-18T23:13:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/58918/TypeScript/issues/58918"}
| 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:97d50246-c341-281b-9bf9-6eb081880823 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9A3E:2E960D:2BBF651:3AFB9AB:6A5DAD5D |
| html-safe-nonce | 6a7e636234df0689013446d8c9932e7a1ded55e96be01d9e0ab7c6575144f4af |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QTNFOjJFOTYwRDoyQkJGNjUxOjNBRkI5QUI6NkE1REFENUQiLCJ2aXNpdG9yX2lkIjoiMzA2NzE3MzY4MTMwMDg3NjYzNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | bdf0ed046f872f59115e95cb1b36cb2a4a96dd0073a9206df327eaba56ff69ab |
| hovercard-subject-tag | issue:2360893787 |
| 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/58918/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b6f89283bbc55c8bbbcf641f7e8a0b2474b0c47e7f00c7bf0cb23b37a479ee37/microsoft/TypeScript/issues/58918 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b6f89283bbc55c8bbbcf641f7e8a0b2474b0c47e7f00c7bf0cb23b37a479ee37/microsoft/TypeScript/issues/58918 |
| og:image:alt | Syntactic Form for Preserving Computed Property Names #58829 When you have isolatedDeclarations, you can't use computed property names in object literals and classes. They transform into different ... |
| 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 | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| 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 | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width