Title: Different result running native vs down-levelled async function · Issue #6068 · microsoft/TypeScript · GitHub
Open Graph Title: Different result running native vs down-levelled async function · Issue #6068 · microsoft/TypeScript
X Title: Different result running native vs down-levelled async function · Issue #6068 · microsoft/TypeScript
Description: In the following example, running original.js directly in MS Edge 25 / EdgeHTML 13 (with experimental JavaScript enabled) outputs "Get to the chopper!" to the console. downlevel.js is produced by running typescript@next (I used v1.8.0-de...
Open Graph Description: In the following example, running original.js directly in MS Edge 25 / EdgeHTML 13 (with experimental JavaScript enabled) outputs "Get to the chopper!" to the console. downlevel.js is produced by r...
X Description: In the following example, running original.js directly in MS Edge 25 / EdgeHTML 13 (with experimental JavaScript enabled) outputs "Get to the chopper!" to the console. downlevel.js is pro...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/6068
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Different result running native vs down-levelled async function","articleBody":"In the following example, running `original.js` directly in MS Edge 25 / EdgeHTML 13 (with experimental JavaScript enabled) outputs `\"Get to the chopper!\"` to the console.\n\n`downlevel.js` is produced by running `typescript@next` (I used v1.8.0-dev.20151210) over `original.js` with the `--allowJs` option. Running `downlevel.js` in MS Edge outputs an error `SCRIPT445: Object doesn't support this action`.\n\n``` javascript\n\n// file: tsconfig.json\n{\n \"compilerOptions\": {\n \"target\": \"ES6\",\n \"allowJs\": true,\n \"outFile\": \"downlevel.js\"\n },\n \"files\": [\"original.js\"]\n}\n\n\n// file: original.js\nvar Promise = \"I promise not to kill anyone\";\nvar foo = async () => \"Get to the chopper!\";\nfoo().then(console.log);\n\n\n// file: downlevel.js (this one is output by tsc)\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {\n return new Promise(function (resolve, reject) {\n generator = generator.call(thisArg, _arguments);\n function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }\n function onfulfill(value) { try { step(\"next\", value); } catch (e) { reject(e); } }\n function onreject(value) { try { step(\"throw\", value); } catch (e) { reject(e); } }\n function step(verb, value) {\n var result = generator[verb](value);\n result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);\n }\n step(\"next\", void 0);\n });\n};\nvar Promise = \"I promise not to kill anyone\";\nvar foo = () => __awaiter(this, void 0, Promise, function* () { return \"Get to the chopper!!\"; });\nfoo().then(console.log);\n\n```\n\nIt looks like the down-levelled code picks up the locally-scoped `Promise` instead of using the native `Promise`.\n","author":{"url":"https://github.com/yortus","@type":"Person","name":"yortus"},"datePublished":"2015-12-11T13:23:42Z","url":"https://github.com/microsoft/TypeScript/issues/6068"}
| 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:9c647cb4-1665-7fb4-23db-91d4de311f20 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8AA2:4E0A:230410:2CA2E8:6B00DD64 |
| html-safe-nonce | da1c45439fc20700357ed517cfaaf323a83a50473016ad1d2341e1b3eea96df0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QUEyOjRFMEE6MjMwNDEwOjJDQTJFODo2QjAwREQ2NCIsInZpc2l0b3JfaWQiOiIyMjQ2NjA2NjExNjA5MDgzMjM2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9004c2831e3d4180350aa3e0c7d799e0cf7916e6b0e35a198711d83839c98f54 |
| hovercard-subject-tag | issue:121707219 |
| 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/6068/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c330ac863cceaf58f135be87323d18c0552d20f76cdf71fe3163f7bb7a021231/microsoft/TypeScript/issues/6068 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c330ac863cceaf58f135be87323d18c0552d20f76cdf71fe3163f7bb7a021231/microsoft/TypeScript/issues/6068 |
| og:image:alt | In the following example, running original.js directly in MS Edge 25 / EdgeHTML 13 (with experimental JavaScript enabled) outputs "Get to the chopper!" to the console. downlevel.js is produced by r... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | yortus |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| 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 | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width