Title: bug: import eliding of `import type` removes previous comments · Issue #43693 · microsoft/TypeScript · GitHub
Open Graph Title: bug: import eliding of `import type` removes previous comments · Issue #43693 · microsoft/TypeScript
X Title: bug: import eliding of `import type` removes previous comments · Issue #43693 · microsoft/TypeScript
Description: Bug Report import eliding of import type removes previous comments 🔎 Search Terms comments before import type are removed ⏯ Playground Link reproduction on codesandbox 💻 Code ts.transpileModule call let result = ts.transpileModule(source...
Open Graph Description: Bug Report import eliding of import type removes previous comments 🔎 Search Terms comments before import type are removed ⏯ Playground Link reproduction on codesandbox 💻 Code ts.transpileModule cal...
X Description: Bug Report import eliding of import type removes previous comments 🔎 Search Terms comments before import type are removed ⏯ Playground Link reproduction on codesandbox 💻 Code ts.transpileModule cal...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/43693
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bug: import eliding of `import type` removes previous comments","articleBody":"# Bug Report\r\n\r\nimport eliding of `import type` removes previous comments\r\n\r\n\u003c!--\r\n Please fill in each section completely. Thank you!\r\n-->\r\n\r\n### 🔎 Search Terms\r\n\r\ncomments before import type are removed\r\n\r\n### ⏯ Playground Link\r\n\r\n[reproduction on codesandbox](https://codesandbox.io/s/typescript-importsnotusedasvalues-preserve-bug-demo-qm23x)\r\n\r\n### 💻 Code\r\n\r\n\u003cdetails>\r\n\u003csummary>ts.transpileModule call\u003c/summary>\r\n\r\n```js\r\nlet result = ts.transpileModule(source, {\r\n fileName: \"test.ts\",\r\n compilerOptions: {\r\n target: \"es2015\",\r\n importsNotUsedAsValues: \"preserve\",\r\n onlyRemoveTypeImports: true,\r\n //isolatedModules: true, // always true in ts.transpileModule\r\n }\r\n});\r\n```\r\n\u003c/details>\r\n\r\n```ts\r\n// before 2\r\n// before 1\r\nimport type { SomeType } from \"./types\"\r\n// after\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\n```js\r\n// after\r\n```\r\n\r\n### 🙂 Expected behavior\r\n\r\n```js\r\n// before 2\r\n// before 1\r\n// after\r\n```\r\n","author":{"url":"https://github.com/milahu","@type":"Person","name":"milahu"},"datePublished":"2021-04-15T20:15:21Z","url":"https://github.com/microsoft/TypeScript/issues/43693"}
| 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:be28b9f4-71a6-a85d-c9fc-afb4f8973e8a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D9C4:157C65:1E2451A:2836D09:6B0173F0 |
| html-safe-nonce | 69a03d0b4b963c700e6fb72b25192c973b300207cd36a27d056c116d8b13b92e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOUM0OjE1N0M2NToxRTI0NTFBOjI4MzZEMDk6NkIwMTczRjAiLCJ2aXNpdG9yX2lkIjoiMTI5MTg2NDUxODc2NjQ1Nzg0MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 57c62b9a50a4f65a57422e220394d3993cc3f95ed32b96732a7d5725b4c5f9bc |
| hovercard-subject-tag | issue:859215871 |
| 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/43693/issue_layout |
| twitter:image | https://opengraph.githubassets.com/eff86e023754200df3b56625a26ef88300090453460b2502d7953bf351aa5ad6/microsoft/TypeScript/issues/43693 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/eff86e023754200df3b56625a26ef88300090453460b2502d7953bf351aa5ad6/microsoft/TypeScript/issues/43693 |
| og:image:alt | Bug Report import eliding of import type removes previous comments 🔎 Search Terms comments before import type are removed ⏯ Playground Link reproduction on codesandbox 💻 Code ts.transpileModule cal... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | milahu |
| 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 | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width