{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9631","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9631/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9631/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9631/events","html_url":"https://github.com/Microsoft/TypeScript/issues/9631","id":164997742,"number":9631,"title":"for...of with strictNullChecks","user":{"login":"johnfn","id":167745,"avatar_url":"https://avatars.githubusercontent.com/u/167745?v=3","gravatar_id":"","url":"https://api.github.com/users/johnfn","html_url":"https://github.com/johnfn","followers_url":"https://api.github.com/users/johnfn/followers","following_url":"https://api.github.com/users/johnfn/following{/other_user}","gists_url":"https://api.github.com/users/johnfn/gists{/gist_id}","starred_url":"https://api.github.com/users/johnfn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnfn/subscriptions","organizations_url":"https://api.github.com/users/johnfn/orgs","repos_url":"https://api.github.com/users/johnfn/repos","events_url":"https://api.github.com/users/johnfn/events{/privacy}","received_events_url":"https://api.github.com/users/johnfn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-12T05:34:46Z","updated_at":"2016-07-12T13:01:56Z","closed_at":null,"body":"I was able to dig up a lot of discussion about why `myArray[i]` should not be a nullable type, and that makes sense. But I wasn't able to dig up anything on `for ... of` loops.\r\n\r\nHow come the following:\r\n\r\n```\r\nconst x = [\"a\", \"b\"]\r\nfor (const y of x) { /* ... */ } \r\n```\r\n\r\nmakes `y` a nullable type? All the arguments saying `myArray[i]` shouldn't be a nullable type also seem to apply to `for ... of` loops, as far as I can see."},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/232040034","html_url":"https://github.com/Microsoft/TypeScript/issues/9631#issuecomment-232040034","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9631","id":232040034,"user":{"login":"jods4","id":3832820,"avatar_url":"https://avatars.githubusercontent.com/u/3832820?v=3","gravatar_id":"","url":"https://api.github.com/users/jods4","html_url":"https://github.com/jods4","followers_url":"https://api.github.com/users/jods4/followers","following_url":"https://api.github.com/users/jods4/following{/other_user}","gists_url":"https://api.github.com/users/jods4/gists{/gist_id}","starred_url":"https://api.github.com/users/jods4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jods4/subscriptions","organizations_url":"https://api.github.com/users/jods4/orgs","repos_url":"https://api.github.com/users/jods4/repos","events_url":"https://api.github.com/users/jods4/events{/privacy}","received_events_url":"https://api.github.com/users/jods4/received_events","type":"User","site_admin":false},"created_at":"2016-07-12T13:01:56Z","updated_at":"2016-07-12T13:01:56Z","body":"Just noticed that the problem also exists for the spread operator:\r\n```ts\r\nconst source: number[] = [1,2,3];\r\nconst target: number[]  = [];\r\ntarget.push(...source);  // error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'\r\n```"}}
{"actor":{"display_login":"jods4"}}