{"action":"closed","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/11140","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/11140/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/11140/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/11140/events","html_url":"https://github.com/Microsoft/TypeScript/issues/11140","id":179107344,"number":11140,"title":"Enum indexer return type should be `string|undefined` for --strictNullChecks","user":{"login":"ulrichb","id":388796,"avatar_url":"https://avatars.githubusercontent.com/u/388796?v=3","gravatar_id":"","url":"https://api.github.com/users/ulrichb","html_url":"https://github.com/ulrichb","followers_url":"https://api.github.com/users/ulrichb/followers","following_url":"https://api.github.com/users/ulrichb/following{/other_user}","gists_url":"https://api.github.com/users/ulrichb/gists{/gist_id}","starred_url":"https://api.github.com/users/ulrichb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ulrichb/subscriptions","organizations_url":"https://api.github.com/users/ulrichb/orgs","repos_url":"https://api.github.com/users/ulrichb/repos","events_url":"https://api.github.com/users/ulrichb/events{/privacy}","received_events_url":"https://api.github.com/users/ulrichb/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-09-25T20:33:25Z","updated_at":"2016-10-24T19:43:53Z","closed_at":"2016-10-24T19:43:53Z","body":"**TypeScript Version:** 2.0.3\r\n\r\n**Code**\r\n\r\n```ts\r\nenum SomeEnum { A = 1, B = 2 }\r\n\r\nfunction lookUp(index: number) {\r\n    return SomeEnum[index].toLowerCase();\r\n}\r\n\r\nconsole.log(lookUp(1)); // => \"a\"\r\nconsole.log(lookUp(2)); // => \"b\"\r\nconsole.log(lookUp(3)); // => runtime error: \"SomeEnum[index] is undefined\"\r\n```\r\n\r\n**Expected behavior:**\r\nWhen using --strictNullChecks, TSC should emit a compile-time error in `lookUp()` because there is no `undefined`-check. => Indexer return type should be `string|undefined` instead of just `string`.\r\n\r\n"}}
{"actor":{"display_login":"RyanCavanaugh"}}