{"action":"opened","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/21621","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/21621/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/21621/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/21621/events","html_url":"https://github.com/Microsoft/TypeScript/issues/21621","id":294209157,"number":21621,"title":"Unexpected output when using esModuleInterop","user":{"login":"frankwallis","id":4387473,"avatar_url":"https://avatars0.githubusercontent.com/u/4387473?v=4","gravatar_id":"","url":"https://api.github.com/users/frankwallis","html_url":"https://github.com/frankwallis","followers_url":"https://api.github.com/users/frankwallis/followers","following_url":"https://api.github.com/users/frankwallis/following{/other_user}","gists_url":"https://api.github.com/users/frankwallis/gists{/gist_id}","starred_url":"https://api.github.com/users/frankwallis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frankwallis/subscriptions","organizations_url":"https://api.github.com/users/frankwallis/orgs","repos_url":"https://api.github.com/users/frankwallis/repos","events_url":"https://api.github.com/users/frankwallis/events{/privacy}","received_events_url":"https://api.github.com/users/frankwallis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-04T16:19:50Z","updated_at":"2018-02-04T16:19:50Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"**TypeScript Version:**  2.8.0-dev.20180204\r\n**Search Terms:** esModuleInterop\r\n**Code**\r\n\r\nI am seeing some unexpected behaviour when using `esModuleInterop` and importing from a commonjs module in 2 different ways at the same time:\r\n\r\n```js\r\n// dep.js\r\nexports.var1 = 'var1';\r\nexports.var2 = 'var2';\r\n```\r\n```ts\r\nimport Deps, { var2 } from './dep';\r\nconsole.log(Deps.var1);\r\nconsole.log(var2);\r\n```\r\n\r\n**Expected behaviour:**\r\nRunning the code outputs:\r\n```\r\nvar1\r\nvar2\r\n```\r\n**Actual behaviour:**\r\nRunning the code outputs:\r\n```\r\nvar1\r\nundefined\r\n```\r\n\r\nDue to the following javascript being generated:\r\n```\r\n\"use strict\";\r\nvar __importDefault = (this && this.__importDefault) || function (mod) {\r\n    return (mod && mod.__esModule) ? mod : { \"default\": mod };\r\n}\r\nexports.__esModule = true;\r\nvar dep_1 = __importDefault(require(\"./dep\"));\r\nconsole.log(dep_1[\"default\"].var1);\r\nconsole.log(dep_1.var2);\r\n```\r\n\r\n**Related Issues:**\r\nNone that I am aware of\r\n\r\nThe real-world code which is triggering this problem is [here](https://github.com/react-component/calendar/blob/master/src/month/MonthTable.js#L1)\r\n\r\nThe 'named' import and 'default' import work fine individually but do not work when they are both present in the same file.\r\n"}}
{"actor":{"display_login":"frankwallis"}}