{"action":"created","issue":{"url":"https://api.github.com/repos/babel/babel/issues/2536","labels_url":"https://api.github.com/repos/babel/babel/issues/2536/labels{/name}","comments_url":"https://api.github.com/repos/babel/babel/issues/2536/comments","events_url":"https://api.github.com/repos/babel/babel/issues/2536/events","html_url":"https://github.com/babel/babel/issues/2536","id":111289389,"number":2536,"title":"Order of export and definition","user":{"login":"cherrydev","id":1072616,"avatar_url":"https://avatars.githubusercontent.com/u/1072616?v=3","gravatar_id":"","url":"https://api.github.com/users/cherrydev","html_url":"https://github.com/cherrydev","followers_url":"https://api.github.com/users/cherrydev/followers","following_url":"https://api.github.com/users/cherrydev/following{/other_user}","gists_url":"https://api.github.com/users/cherrydev/gists{/gist_id}","starred_url":"https://api.github.com/users/cherrydev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cherrydev/subscriptions","organizations_url":"https://api.github.com/users/cherrydev/orgs","repos_url":"https://api.github.com/users/cherrydev/repos","events_url":"https://api.github.com/users/cherrydev/events{/privacy}","received_events_url":"https://api.github.com/users/cherrydev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-13T23:02:28Z","updated_at":"2015-10-13T23:33:29Z","closed_at":null,"body":"I don't know if this is really a bug in babel or simply a difference in how Typescript and babel transpiles ES6-style module syntax into common.\r\n\r\nThe typescript compiler happily works with this when it is targeting ES5:\r\n\r\nfooModule.ts\r\n```typescript\r\nexport {foo};\r\n\r\nfunction foo() {\r\nconsole.log(\"foo\");\r\n}\r\n```\r\n\r\n```typescript\r\nimport {foo} from \"./fooModule\";\r\nfoo();\r\n```\r\nWill output \"foo\";\r\n\r\nInstead, when I have typescript target ES6 and THEN have babel transpile the ES6 modules to CommonJS (for Browserify) foo will be undefined because places the `exports.foo = foo` statement literally where the `export {foo};` statement is, instead of what Typescript does, which is placing it at the bottom of the module after everything has been defined.\r\n\r\nWould you say this Typescript compiler is contrary to the ES6 spec by 'de-hoisting' the export statements and a smart compiler would generate an error?  Or is Typescript behaviour 'correct'?  The ES6 spec DOES specifically say that imports are always hoisted to the top because (like `var`) `import` is a magic keyword."},"comment":{"url":"https://api.github.com/repos/babel/babel/issues/comments/147883675","html_url":"https://github.com/babel/babel/issues/2536#issuecomment-147883675","issue_url":"https://api.github.com/repos/babel/babel/issues/2536","id":147883675,"user":{"login":"sebmck","id":853712,"avatar_url":"https://avatars.githubusercontent.com/u/853712?v=3","gravatar_id":"","url":"https://api.github.com/users/sebmck","html_url":"https://github.com/sebmck","followers_url":"https://api.github.com/users/sebmck/followers","following_url":"https://api.github.com/users/sebmck/following{/other_user}","gists_url":"https://api.github.com/users/sebmck/gists{/gist_id}","starred_url":"https://api.github.com/users/sebmck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebmck/subscriptions","organizations_url":"https://api.github.com/users/sebmck/orgs","repos_url":"https://api.github.com/users/sebmck/repos","events_url":"https://api.github.com/users/sebmck/events{/privacy}","received_events_url":"https://api.github.com/users/sebmck/received_events","type":"User","site_admin":false},"created_at":"2015-10-13T23:33:29Z","updated_at":"2015-10-13T23:33:29Z","body":"Module formatter remaps aren't taking into consideration declarations that can cause a binding such as non assignment/update expressions."}}