Title: Design Meeting Notes, 4/13/2022 · Issue #48686 · microsoft/TypeScript · GitHub
Open Graph Title: Design Meeting Notes, 4/13/2022 · Issue #48686 · microsoft/TypeScript
X Title: Design Meeting Notes, 4/13/2022 · Issue #48686 · microsoft/TypeScript
Description: Resolution mode assertions for import type #48644 (notes in this section from Ryan Cavanaugh (@RyanCavanaugh) with some edits from me) Controls how resolution acts - import-style, or require-style Pushback from some community members abo...
Open Graph Description: Resolution mode assertions for import type #48644 (notes in this section from Ryan Cavanaugh (@RyanCavanaugh) with some edits from me) Controls how resolution acts - import-style, or require-style ...
X Description: Resolution mode assertions for import type #48644 (notes in this section from Ryan Cavanaugh (@RyanCavanaugh) with some edits from me) Controls how resolution acts - import-style, or require-style ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/48686
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Design Meeting Notes, 4/13/2022","articleBody":"## Resolution mode assertions for `import type`\r\n\r\n#48644\r\n\r\n(notes in this section from @RyanCavanaugh with some edits from me)\r\n\r\n* Controls how resolution acts - `import`-style, or `require`-style\r\n* Pushback from some community members about whether this is an appropriate use of assertion syntax\r\n* Caveat: `import type` is \"our\" syntax - doesn't work elsewhere\r\n* Real import assertions are after-the-fact checks, not behavioral modifiers\r\n* Alternatives?\r\n * Comment directives\r\n * Dotted names like `import.require` and `import.import` (nonstarter)\r\n * Invent our own different keywords\r\n* This might be confusing for users\r\n* Deno may care because... they have semantic comments too?\r\n* Additional configuration properties might need to appear here in the future\r\n* Would using a more clearly-TS property name in this position assuage concerns?\r\n * Unclear, but probably no - the argument seems to center around the use of `assert` syntax.\r\n* By re-using `assert`, other tools don't need new syntactic handling\r\n* We use other JS-apparent syntax (`{ x: y }`, etc)\r\n* What happens if we add `import type` to JS?\r\n * The assertion would also be ignored, resolution would never even occur\r\n* What alternatives were considered during implementation?\r\n * Various comments, `as`\r\n* Sidebar: Why do real `import` assertions exist?\r\n * Validation\r\n* The spec says you can't use assertions as a cache key, i.e. you can't use it to modify resolution, but we're using it for exactly that - seems bad\r\n* What about rewriting the name to include a custom protocol?\r\n * Super dangerous; we can't predict what this will look like\r\n* What happens if we don't emit these kind of paths?\r\n * You get the \"this path is non-portable\" error\r\n* We don't want multiple ways to do this\r\n* How usable is node esm without this?\r\n * ??\r\n* Can we just wait for CJS to go away?\r\n * ???\r\n* Other third-party tools will be mad if we add new rando syntax they have to deal with just for this.\r\n* Can we fix this with compile-time decorators?\r\n* Idea: possibly gate this syntax to nightly-only, emit an error upon use.\r\n\r\n## Stage 3 Decorator Placement\r\n\r\n* Our support for decorators originally placed decorators coming before the `export` keyword.\r\n * ECMA-262 direction is that the syntax would be\r\n \r\n ```ts\r\n export default\r\n @someDecorator1\r\n @someDecorator2\r\n class Foo {\r\n\r\n }\r\n ```\r\n* The placement of fields on our objects is sensitive to their positions. We always expect specific fields to come before others so that we can correctly do source-maps, syntax tree printing, etc.\r\n * So can't mix `export` and `default` into the same bag as `abstract` when they're split up by decorators preceding them.\r\n* Idea\r\n * Split between `leadingModifiers` and `trailingModifiers`\r\n * API needs to provide `modifiers` as `[...leadingModifiers, ...trailingModifiers]`\r\n * Still creates a lot of breaking changes.\r\n* The changes here are cumbersome, and changes whatever API users might expect.\r\n* Would it make sense to have leading/trailing decorators instead?\r\n * No, still need to split the modifiers.\r\n* TC39 seems pretty resistant to take any feedback from us on this. 😕\r\n * Seems unfortunate since this affects, Prettier, ESLint, etc. too.","author":{"url":"https://github.com/DanielRosenwasser","@type":"Person","name":"DanielRosenwasser"},"datePublished":"2022-04-13T23:27:17Z","url":"https://github.com/microsoft/TypeScript/issues/48686"}
| 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:97a3cb1a-72ed-4b08-ab7e-b6d49864818f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E78A:358871:D60A5D:11B7C47:6B00F935 |
| html-safe-nonce | 5d0ff8b8e3c5b8187b482b0894bb8ce5995c8128afc5c6d836f4544ef1c93bee |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzhBOjM1ODg3MTpENjBBNUQ6MTFCN0M0Nzo2QjAwRjkzNSIsInZpc2l0b3JfaWQiOiIyMzI0NDkxNDIyOTc3ODY2NzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f553df2bfe0e4d84b3c08218886b5c8d65f43c0214566346a13f48b045e819ba |
| hovercard-subject-tag | issue:1203880245 |
| 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/48686/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dce1e3be8f7f51cccc7a9f78f9b43051b7bbbfe4cd295967825ae830c90b8334/microsoft/TypeScript/issues/48686 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dce1e3be8f7f51cccc7a9f78f9b43051b7bbbfe4cd295967825ae830c90b8334/microsoft/TypeScript/issues/48686 |
| og:image:alt | Resolution mode assertions for import type #48644 (notes in this section from Ryan Cavanaugh (@RyanCavanaugh) with some edits from me) Controls how resolution acts - import-style, or require-style ... |
| 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 | e208d86428ec00a57ade75058166297440e8128a01e5287c31a53dc042bbf187 |
| 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 | 7dafd017fb7809a839c443dba08622af38e63c09 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width