{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2941","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2941/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2941/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2941/events","html_url":"https://github.com/Microsoft/TypeScript/issues/2941","id":71570439,"number":2941,"title":"Enums don't work with TypeScript 1.5.0-alpha properly","user":{"login":"panuhorsmalahti","id":2162413,"avatar_url":"https://avatars.githubusercontent.com/u/2162413?v=3","gravatar_id":"","url":"https://api.github.com/users/panuhorsmalahti","html_url":"https://github.com/panuhorsmalahti","followers_url":"https://api.github.com/users/panuhorsmalahti/followers","following_url":"https://api.github.com/users/panuhorsmalahti/following{/other_user}","gists_url":"https://api.github.com/users/panuhorsmalahti/gists{/gist_id}","starred_url":"https://api.github.com/users/panuhorsmalahti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/panuhorsmalahti/subscriptions","organizations_url":"https://api.github.com/users/panuhorsmalahti/orgs","repos_url":"https://api.github.com/users/panuhorsmalahti/repos","events_url":"https://api.github.com/users/panuhorsmalahti/events{/privacy}","received_events_url":"https://api.github.com/users/panuhorsmalahti/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-28T12:06:25Z","updated_at":"2015-04-28T14:03:42Z","closed_at":null,"body":"I noticed a breaking change while testing TypeScript 1.5.0-alpha. In 1.4.1, the enum's are replaced with numerical values in the JavaScript output. In 1.5.0-alpha, they're not compiled at all.\r\n\r\n```\r\n// mylib.d.ts\r\ndeclare module Test {\r\n\texport enum MyEnum {\r\n\t\tfoo = 0,\r\n\t\tbar = 1\r\n\t}\r\n}\r\n```\r\n\r\n```\r\n// test.ts\r\nvar value = Test.MyEnum.bar;\r\n```\r\n\r\nExpected output test.js (using TypeScript 1.4.1):\r\n```\r\nvar value = 1 /* bar */;\r\n```\r\n\r\nActual output test.js (using TypeScript 1.5.0-alpha):\r\n```\r\nvar value = Test.MyEnum.bar;\r\n```\r\n\r\nIf this is not a bug, I'm not sure how I can use enums which are in a module with TypeScript 1.5.x. I compiled with 'node node_modules\\typescript\\bin\\tsc test.ts mylib.d.ts'."},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/97074208","html_url":"https://github.com/Microsoft/TypeScript/issues/2941#issuecomment-97074208","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2941","id":97074208,"user":{"login":"jonathandturner","id":547158,"avatar_url":"https://avatars.githubusercontent.com/u/547158?v=3","gravatar_id":"","url":"https://api.github.com/users/jonathandturner","html_url":"https://github.com/jonathandturner","followers_url":"https://api.github.com/users/jonathandturner/followers","following_url":"https://api.github.com/users/jonathandturner/following{/other_user}","gists_url":"https://api.github.com/users/jonathandturner/gists{/gist_id}","starred_url":"https://api.github.com/users/jonathandturner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonathandturner/subscriptions","organizations_url":"https://api.github.com/users/jonathandturner/orgs","repos_url":"https://api.github.com/users/jonathandturner/repos","events_url":"https://api.github.com/users/jonathandturner/events{/privacy}","received_events_url":"https://api.github.com/users/jonathandturner/received_events","type":"User","site_admin":false},"created_at":"2015-04-28T14:03:42Z","updated_at":"2015-04-28T14:03:42Z","body":"Have you tried using const enums?  Because of the cleanup in enums, some of the automatic inlining was moved out.  You can get it back by using a 'const enum', which always inlines:\r\n\r\n```TypeScript\r\n// mylib.d.ts\r\ndeclare module Test {\r\n    export const enum MyEnum {\r\n        foo = 0,\r\n        bar = 1\r\n    }\r\n}\r\n\r\nvar x = Test.MyEnum.bar;\r\n```"}}