Title: __importStar sometimes inlined when using dynamic imports with --importHelpers · Issue #27415 · microsoft/TypeScript · GitHub
Open Graph Title: __importStar sometimes inlined when using dynamic imports with --importHelpers · Issue #27415 · microsoft/TypeScript
X Title: __importStar sometimes inlined when using dynamic imports with --importHelpers · Issue #27415 · microsoft/TypeScript
Description: TypeScript Version: 3.1.1 Search Terms: __importStar tslib Code a.ts: import('b').then(b => console.log(b)); compile with tsc a.ts --esModuleInterop --importHelpers Expected behavior: some type errors, but emitted code should require("ts...
Open Graph Description: TypeScript Version: 3.1.1 Search Terms: __importStar tslib Code a.ts: import('b').then(b => console.log(b)); compile with tsc a.ts --esModuleInterop --importHelpers Expected behavior: some type err...
X Description: TypeScript Version: 3.1.1 Search Terms: __importStar tslib Code a.ts: import('b').then(b => console.log(b)); compile with tsc a.ts --esModuleInterop --importHelpers Expected behavior: so...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/27415
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"__importStar sometimes inlined when using dynamic imports with --importHelpers","articleBody":"\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:** 3.1.1\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:** __importStar tslib\r\n\r\n**Code**\r\na.ts:\r\n```ts\r\nimport('b').then(b => console.log(b));\r\n```\r\ncompile with\r\n```\r\ntsc a.ts --esModuleInterop --importHelpers\r\n```\r\n\r\n**Expected behavior:**\r\nsome type errors, but emitted code should `require(\"tslib\")` and use __importStar from there\r\n\r\n**Actual behavior:**\r\nsome type errors and generated code looks like this:\r\n```\r\nvar __importStar = (this && this.__importStar) || function (mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result[\"default\"] = mod;\r\n return result;\r\n};\r\nPromise.resolve().then(function () { return __importStar(require('b')); }).then(function (b) { return console.log(b); });\r\n```\r\n\r\nbtw an example that works correctly:\r\n```\r\nimport('c').then(b => console.log(b));\r\n\r\nclass Foo {}\r\n\r\nexport class Bar extends Foo {}\r\n```\r\nboth the extends and the export seem to be necessary\r\n\r\n**Playground Link:** N/A (--esModuleInterop doesn't exist in the playground)\r\n\r\n**Related Issues:** This is basically #21560 but replacing regular imports with dynamic imports","author":{"url":"https://github.com/dgoldstein0","@type":"Person","name":"dgoldstein0"},"datePublished":"2018-09-28T07:55:41Z","url":"https://github.com/microsoft/TypeScript/issues/27415"}
| 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:6c5725a8-ff41-d871-94c6-9314281dd9e8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8698:269AD9:D3C51C:11C28A4:6B010086 |
| html-safe-nonce | 1426b502ecd1b29322cc170880545ed527217d518ba7f05dbc2833b5840812d7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Njk4OjI2OUFEOTpEM0M1MUM6MTFDMjhBNDo2QjAxMDA4NiIsInZpc2l0b3JfaWQiOiI2MDgwODY5Mzc0NDA1NzA1ODYyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a2c7275c87093d3f9ef8334103443a2e73e6535100bf8a2c0d0b17350dcdafb7 |
| hovercard-subject-tag | issue:364780335 |
| 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/27415/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8c251cdb9179da2bf055c5c5d6908101e368476e3bcd704e5617ea79e0a99dd3/microsoft/TypeScript/issues/27415 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8c251cdb9179da2bf055c5c5d6908101e368476e3bcd704e5617ea79e0a99dd3/microsoft/TypeScript/issues/27415 |
| og:image:alt | TypeScript Version: 3.1.1 Search Terms: __importStar tslib Code a.ts: import('b').then(b => console.log(b)); compile with tsc a.ts --esModuleInterop --importHelpers Expected behavior: some type err... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dgoldstein0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width