{"action":"created","issue":{"url":"https://api.github.com/repos/TypeStrong/atom-typescript/issues/570","labels_url":"https://api.github.com/repos/TypeStrong/atom-typescript/issues/570/labels{/name}","comments_url":"https://api.github.com/repos/TypeStrong/atom-typescript/issues/570/comments","events_url":"https://api.github.com/repos/TypeStrong/atom-typescript/issues/570/events","html_url":"https://github.com/TypeStrong/atom-typescript/issues/570","id":106399483,"number":570,"title":"exported Enum resolution error","user":{"login":"christyharagan","id":825421,"avatar_url":"https://avatars.githubusercontent.com/u/825421?v=3","gravatar_id":"","url":"https://api.github.com/users/christyharagan","html_url":"https://github.com/christyharagan","followers_url":"https://api.github.com/users/christyharagan/followers","following_url":"https://api.github.com/users/christyharagan/following{/other_user}","gists_url":"https://api.github.com/users/christyharagan/gists{/gist_id}","starred_url":"https://api.github.com/users/christyharagan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christyharagan/subscriptions","organizations_url":"https://api.github.com/users/christyharagan/orgs","repos_url":"https://api.github.com/users/christyharagan/repos","events_url":"https://api.github.com/users/christyharagan/events{/privacy}","received_events_url":"https://api.github.com/users/christyharagan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/TypeStrong/atom-typescript/labels/status:needs-more-info","name":"status:needs-more-info","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-14T18:21:46Z","updated_at":"2015-09-15T09:12:21Z","closed_at":null,"body":"Hey,\r\n\r\nI *think* this is an atom-typescript error as I've tried compiling this from typescript@next directly, and it seems to compile fine.\r\n\r\nThe error relates to enums, and exports using the new typescript node resolution (with the typings property in the package.json).\r\n\r\nThe bug can be reproduced through the following scenario: (Sadly I can't attach a .zip, so ask me if you want the contents directly for easy import and analysis):\r\n\r\nThree projects: ```a```, ```b```, ```c```.\r\n\r\n```b``` depends on ```a```\r\n```c``` depends on ```b```\r\n\r\n```a``` exports an enum through its index.ts:\r\n\r\n```TypeScript\r\nexport enum E{}\r\n```\r\n\r\n```b``` then exports a function that returns ```E``` through its index.ts:\r\n\r\n```TypeScript\r\nimport {E} from 'a'\r\nexport function f():E {\r\n  return null\r\n}\r\n```\r\n\r\n```c``` then consumes ```f``` through its index.ts:\r\n\r\n```TypeScript\r\nimport {E} from 'a'\r\nimport {f} from 'b'\r\n\r\nlet e:E = f()\r\n```\r\n\r\nThere is now an error for ```e```:\r\n\r\n```\r\nType 'E' is not assignable to type 'E'.\r\n```\r\n\r\nAll three packages have a package.json that looks like this:\r\n```\r\n{\r\n  \"name\": \"b\",\r\n  \"version\": \"1\",\r\n  \"main\": \"lib/index.js\",\r\n  \"typings\": \"lib/index.d.ts\",\r\n  \"dependencies\": {\r\n    \"a\": \"1\"\r\n  }\r\n}\r\n```\r\n\r\nAnd a tsconfig.json that looks like:\r\n```\r\n{\r\n    \"compilerOptions\": {\r\n        \"declaration\": true,\r\n        \"module\": \"commonjs\",\r\n        \"rootDir\": \"./src\",\r\n        \"target\": \"es5\",\r\n        \"outDir\": \"./lib\"\r\n    },\r\n    \"files\": [\r\n        \"src/index.ts\"\r\n    ]\r\n}\r\n```\r\n\r\nNow, what's especially interesting, is if you have the rootDir and outDir the same, then the error doesn't occur.\r\n\r\nFurthermore, this defect occurs if ```f``` were to export another symbol (e.g. an interface) which references an exported enum somewhere within it's structure or hierarchy (which was how I encountered this bug, and it took me some time to track it down to this specific scenario)\r\n\r\nThis only seems to affect enums, not other types."},"comment":{"url":"https://api.github.com/repos/TypeStrong/atom-typescript/issues/comments/140332715","html_url":"https://github.com/TypeStrong/atom-typescript/issues/570#issuecomment-140332715","issue_url":"https://api.github.com/repos/TypeStrong/atom-typescript/issues/570","id":140332715,"user":{"login":"christyharagan","id":825421,"avatar_url":"https://avatars.githubusercontent.com/u/825421?v=3","gravatar_id":"","url":"https://api.github.com/users/christyharagan","html_url":"https://github.com/christyharagan","followers_url":"https://api.github.com/users/christyharagan/followers","following_url":"https://api.github.com/users/christyharagan/following{/other_user}","gists_url":"https://api.github.com/users/christyharagan/gists{/gist_id}","starred_url":"https://api.github.com/users/christyharagan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christyharagan/subscriptions","organizations_url":"https://api.github.com/users/christyharagan/orgs","repos_url":"https://api.github.com/users/christyharagan/repos","events_url":"https://api.github.com/users/christyharagan/events{/privacy}","received_events_url":"https://api.github.com/users/christyharagan/received_events","type":"User","site_admin":false},"created_at":"2015-09-15T09:12:21Z","updated_at":"2015-09-15T09:12:21Z","body":"Hey Basarat,\r\n\r\nOf course :) here you go:\r\n\r\nhttps://github.com/christyharagan/typeScript-enum-export-bug"}}