Title: new import syntax incorrectly generating amd require on exported function compared to class member / exported function · Issue #16641 · microsoft/TypeScript · GitHub
Open Graph Title: new import syntax incorrectly generating amd require on exported function compared to class member / exported function · Issue #16641 · microsoft/TypeScript
X Title: new import syntax incorrectly generating amd require on exported function compared to class member / exported function · Issue #16641 · microsoft/TypeScript
Description: TypeScript Version: 2.4.0 The following things work as expected export class Test { async LoadSomething() { const something = await import("./something"); } } export async function LoadSomething() { const something = await import("./some...
Open Graph Description: TypeScript Version: 2.4.0 The following things work as expected export class Test { async LoadSomething() { const something = await import("./something"); } } export async function LoadSomething() ...
X Description: TypeScript Version: 2.4.0 The following things work as expected export class Test { async LoadSomething() { const something = await import("./something"); } } export async function LoadSo...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/16641
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"new import syntax incorrectly generating amd require on exported function compared to class member / exported function","articleBody":"**TypeScript Version:** 2.4.0 \r\n\r\nThe following things work as expected\r\n\r\n```ts\r\nexport class Test \r\n{\r\n async LoadSomething() {\r\n const something = await import(\"./something\");\r\n }\r\n}\r\n\r\nexport async function LoadSomething() {\r\n const something = await import(\"./something\");\r\n}\r\n```\r\n\r\nwhich will generate\r\n\r\n```js\r\nnew Promise(function (resolve_1, reject_1) { require([\"./something\"], resolve_1, reject_1); })];\r\n```\r\n\r\nwhereas \r\n\r\n```ts\r\n export = async function() {\r\n const something = await import(\"./something\");\r\n }\r\n```\r\n\r\n```ts\r\n// A *self-contained* demonstration of the problem follows...\r\n\r\n```\r\n\r\nwill generate \r\n\r\n```js\r\n import(\"./something\")\r\n```\r\n\r\n**Expected behavior:**\r\nCode which is emitted should be \r\n\r\n```js\r\nnew Promise(function (resolve_1, reject_1) { require([\"./something\"], resolve_1, reject_1); })];\r\n```\r\n\r\n\r\n","author":{"url":"https://github.com/Saulzi","@type":"Person","name":"Saulzi"},"datePublished":"2017-06-20T11:31:22Z","url":"https://github.com/microsoft/TypeScript/issues/16641"}
| 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:95a0bb2d-cc0f-3c5f-46d9-5f4d25e8b0aa |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ECFE:363D8E:C5CE57:FE7098:6B00EB87 |
| html-safe-nonce | 68e6169adab2b62fc31a14cf9bd429edadf014b6bc5e2f39f5aaff4fd1b09567 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQ0ZFOjM2M0Q4RTpDNUNFNTc6RkU3MDk4OjZCMDBFQjg3IiwidmlzaXRvcl9pZCI6IjE2NjcxNjEyMzgyNjQxNjUxOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5428b5207e48775de06520039097c477ce33b717e3d96fd39f63e9b8abae7825 |
| hovercard-subject-tag | issue:237178646 |
| 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/16641/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7c7ab57eb628b3eca9f369a438d52f4e82b7ec2d707e37e969ec7051ae16dcd0/microsoft/TypeScript/issues/16641 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7c7ab57eb628b3eca9f369a438d52f4e82b7ec2d707e37e969ec7051ae16dcd0/microsoft/TypeScript/issues/16641 |
| og:image:alt | TypeScript Version: 2.4.0 The following things work as expected export class Test { async LoadSomething() { const something = await import("./something"); } } export async function LoadSomething() ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Saulzi |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| 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 | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width