{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/8921","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/8921/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/8921/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/8921/events","html_url":"https://github.com/Microsoft/TypeScript/issues/8921","id":157931388,"number":8921,"title":"Allow index signature parameter type to be String Literal Type and enum member.","user":{"login":"RainingChain","id":5470583,"avatar_url":"https://avatars.githubusercontent.com/u/5470583?v=3","gravatar_id":"","url":"https://api.github.com/users/RainingChain","html_url":"https://github.com/RainingChain","followers_url":"https://api.github.com/users/RainingChain/followers","following_url":"https://api.github.com/users/RainingChain/following{/other_user}","gists_url":"https://api.github.com/users/RainingChain/gists{/gist_id}","starred_url":"https://api.github.com/users/RainingChain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RainingChain/subscriptions","organizations_url":"https://api.github.com/users/RainingChain/orgs","repos_url":"https://api.github.com/users/RainingChain/repos","events_url":"https://api.github.com/users/RainingChain/events{/privacy}","received_events_url":"https://api.github.com/users/RainingChain/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-01T15:07:24Z","updated_at":"2016-06-02T00:19:46Z","closed_at":null,"body":"At the moment, index signature parameter type must be string or number.\r\nNow that Typescript supports String literal types, it would be great if it could be used for index signature parameter type as well.\r\n\r\nFor example:\r\n\r\n\ttype MyString = \"a\" | \"b\" | \"c\";\r\n\r\n\tvar MyMap:{[id:MyString] : number} = {};\r\n\tMyMap[\"a\"] = 1; // valid\r\n\tMyMap[\"asd\"] = 2;\t//invalid\r\n\r\n--- \r\n\r\nIt would be also useful if it could also work with Enums. For example:\r\n\r\n\tenum MyEnum {\r\n\t\ta = <any>\"a\",\r\n\t\tb = <any>\"b\",\r\n\t\tc = <any>\"c\",\r\n\t\td = <any>\"d\",\r\n\t}\r\n\r\n\tvar MyMap:{[id:MyEnum] : number} = {};\r\n\tMyMap[MyEnum.a] = 1; // valid\r\n\tMyMap[\"asd\"] = 2;\t//invalid\r\n\r\n\tvar MyMap:{[id:MyEnum] : number} = {\r\n\t\t[MyEnum.a]:1,\t// valid\r\n\t\t\"asdas\":2,\t//invalid\r\n\t}"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/223163162","html_url":"https://github.com/Microsoft/TypeScript/issues/8921#issuecomment-223163162","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/8921","id":223163162,"user":{"login":"Arnavion","id":1096010,"avatar_url":"https://avatars.githubusercontent.com/u/1096010?v=3","gravatar_id":"","url":"https://api.github.com/users/Arnavion","html_url":"https://github.com/Arnavion","followers_url":"https://api.github.com/users/Arnavion/followers","following_url":"https://api.github.com/users/Arnavion/following{/other_user}","gists_url":"https://api.github.com/users/Arnavion/gists{/gist_id}","starred_url":"https://api.github.com/users/Arnavion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Arnavion/subscriptions","organizations_url":"https://api.github.com/users/Arnavion/orgs","repos_url":"https://api.github.com/users/Arnavion/repos","events_url":"https://api.github.com/users/Arnavion/events{/privacy}","received_events_url":"https://api.github.com/users/Arnavion/received_events","type":"User","site_admin":false},"created_at":"2016-06-02T00:19:46Z","updated_at":"2016-06-02T00:19:46Z","body":"Duplicate of #2491 and #5683"}}
{"actor":{"display_login":"Arnavion"}}