Title: ESM-only packages come with synthesized default in `moduleResolution: bundler` · Issue #54752 · microsoft/TypeScript · GitHub
Open Graph Title: ESM-only packages come with synthesized default in `moduleResolution: bundler` · Issue #54752 · microsoft/TypeScript
X Title: ESM-only packages come with synthesized default in `moduleResolution: bundler` · Issue #54752 · microsoft/TypeScript
Description: Bug Report 🔎 Search Terms module resolution bundler synthesized default 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link Playground link with relevant code 💻 Code // @moduleResolution: bu...
Open Graph Description: Bug Report 🔎 Search Terms module resolution bundler synthesized default 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link Playground link with relev...
X Description: Bug Report 🔎 Search Terms module resolution bundler synthesized default 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link Playground link with r...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/54752
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ESM-only packages come with synthesized default in `moduleResolution: bundler`","articleBody":"# Bug Report\r\n\r\n### 🔎 Search Terms\r\n\r\nmodule resolution bundler synthesized default\r\n\r\n### 🕗 Version \u0026 Regression Information\r\n\r\n- This is the behavior in every version I tried\r\n\r\n### ⏯ Playground Link\r\n\r\n[Playground link with relevant code](https://www.typescriptlang.org/play?target=99\u0026moduleResolution=100#code/PTAEAEFsHsBMFcA2BTASsgztR8AuBLaAOwC5QAjeI2FAJwCgQIYEUzMjkAPXRscXAENaAc2S52GTj3r18kAA7RauUJFiCMuADSgA3qFzQAyrlr4iI0AF9QAM1rRIoAETrNuALR58iT0c8tc0sXAG5QJlwATwVMMgBmADoAJkSABll3LUSjU2CRelyzCwL6AGNiLTUNLWTQAF5QQQB3QXxVeSUVAAo3Gq8fPwCgkpcASnDImLjQJNSM+izcVNhkO0EkXiWVtY3EXByTYstF-tSi-NluLtU9ayA)\r\n\r\n### 💻 Code\r\n\r\n```ts\r\n// @moduleResolution: bundler\r\n// @module: esnext\r\n// @target: esnext\r\n\r\nimport mdast, { toString } from \"mdast-util-to-string\"; // types: 3.2.0\r\n\r\nmdast.toString\r\ntoString\r\n\r\nconst mdast2 = await import(\"mdast-util-to-string\"); // types: 3.2.0\r\n\r\nmdast2.default\r\nmdast2.default.toString\r\nmdast2.toString\r\n\r\nexport {}\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\n`default` export is available here and points to the whole module. I don't think this is right, even with `moduleResolution: bundler` but I can be wrong about this since it's really hard to know what kind of assumptions and goals this mode has when it comes to subtle details\r\n\r\n### 🙂 Expected behavior\r\n\r\nI don't expect `default` to be available here since this ESM-only package **doesn't** have a default export. \r\n\r\nNote that even if this isn't a bug, `.default` available on that dynamically imported binding should behave in the same way in the IDE as the specifier coming from the import statement. Right now the hover info isn't available on it and go to (type?) definition doesn't work on it with cmd+click.\r\n\r\ncc @andrewbranch \r\n","author":{"url":"https://github.com/Andarist","@type":"Person","name":"Andarist"},"datePublished":"2023-06-23T11:40:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/54752/TypeScript/issues/54752"}
| 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:c1c8cea1-c9a9-87a1-5bb4-688bbd3a674e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AA90:1712DC:523A1F3:6B05D03:6A5D75E0 |
| html-safe-nonce | 21c8a29d9be2f6e69fdeea05f0d67aa8250eb819e380ca0299dd7f651e795650 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQTkwOjE3MTJEQzo1MjNBMUYzOjZCMDVEMDM6NkE1RDc1RTAiLCJ2aXNpdG9yX2lkIjoiNDkyMDUyMTI2MTQ0ODAwMDk5MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6cbe96f51ee8387dec8f6897a41cfb6a7d48160f8ab5a62841b4dfbbc3b5b90d |
| hovercard-subject-tag | issue:1771314217 |
| 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/54752/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7fed29c43520d3e12e4c475075852763e052b5dc58da3ca4e7d32f4384eb39f4/microsoft/TypeScript/issues/54752 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7fed29c43520d3e12e4c475075852763e052b5dc58da3ca4e7d32f4384eb39f4/microsoft/TypeScript/issues/54752 |
| og:image:alt | Bug Report 🔎 Search Terms module resolution bundler synthesized default 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link Playground link with relev... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Andarist |
| 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