{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3192","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3192/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3192/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3192/events","html_url":"https://github.com/Microsoft/TypeScript/issues/3192","id":77317620,"number":3192,"title":"Proposal: String enums","user":{"login":"jbondc","id":199519,"avatar_url":"https://avatars.githubusercontent.com/u/199519?v=3","gravatar_id":"","url":"https://api.github.com/users/jbondc","html_url":"https://github.com/jbondc","followers_url":"https://api.github.com/users/jbondc/followers","following_url":"https://api.github.com/users/jbondc/following{/other_user}","gists_url":"https://api.github.com/users/jbondc/gists{/gist_id}","starred_url":"https://api.github.com/users/jbondc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbondc/subscriptions","organizations_url":"https://api.github.com/users/jbondc/orgs","repos_url":"https://api.github.com/users/jbondc/repos","events_url":"https://api.github.com/users/jbondc/events{/privacy}","received_events_url":"https://api.github.com/users/jbondc/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Needs%20Proposal","name":"Needs Proposal","color":"556b75"},{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Suggestion","name":"Suggestion","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-05-17T14:10:36Z","updated_at":"2015-09-04T14:45:37Z","closed_at":null,"body":"A string enum is inferred by looking at the constant value of the initializer of its first member:\r\n```\r\nenum stringsInferred {\r\n   a = \"a\",\r\n   b, // \"b\"\r\n   c  // \"c\"\r\n}\r\n```\r\nOr it is declared using a string index:\r\n```\r\nenum stringsDeclared {\r\n   [prop: string] : string;\r\n   a, // \"a\"\r\n   B, // \"B\"\r\n   c  // \"c\"\r\n}\r\n```\r\nThe auto initialized value on an enum is its property name. \r\n\r\n## Inferred enum special case\r\n```\r\nenum stringsLowerCase {\r\n   Shoes = \"shoes\", // If the first member has lowercase chars, then lowercase all other member values\r\n   Boots, // \"boots\"\r\n   Feet  // \"feet\"\r\n}\r\n```\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/137755484","html_url":"https://github.com/Microsoft/TypeScript/issues/3192#issuecomment-137755484","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3192","id":137755484,"user":{"login":"rotemdan","id":8589488,"avatar_url":"https://avatars.githubusercontent.com/u/8589488?v=3","gravatar_id":"","url":"https://api.github.com/users/rotemdan","html_url":"https://github.com/rotemdan","followers_url":"https://api.github.com/users/rotemdan/followers","following_url":"https://api.github.com/users/rotemdan/following{/other_user}","gists_url":"https://api.github.com/users/rotemdan/gists{/gist_id}","starred_url":"https://api.github.com/users/rotemdan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rotemdan/subscriptions","organizations_url":"https://api.github.com/users/rotemdan/orgs","repos_url":"https://api.github.com/users/rotemdan/repos","events_url":"https://api.github.com/users/rotemdan/events{/privacy}","received_events_url":"https://api.github.com/users/rotemdan/received_events","type":"User","site_admin":false},"created_at":"2015-09-04T14:45:37Z","updated_at":"2015-09-04T14:45:37Z","body":"This may turn out a bit long for a `const enum` that is also exported:\r\n```ts\r\nexport const string enum PromiseState {\r\n    Pending,\r\n    Fulfilled,\r\n    Rejected\r\n}\r\n```\r\nSo maybe an alternative using some sort of a psuedo-generic type parameter?\r\n```ts\r\nexport const enum PromiseState<string> {\r\n    Pending,\r\n    Fulfilled,\r\n    Rejected\r\n}\r\n```\r\nDue to [issues with different languages, alphabets, and locales](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase) it would be difficult to apply a correct conversion to lowercase/uppercase in many languages other than English. So just preserving the plain casing and allowing custom ones through `=` seems like a reasonable compromise."}}