{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9653","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9653/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9653/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9653/events","html_url":"https://github.com/Microsoft/TypeScript/issues/9653","id":165176973,"number":9653,"title":"Guidelines for choosing between `null` and `undefined` with `strictNullChecks`","user":{"login":"olmobrutall","id":720953,"avatar_url":"https://avatars.githubusercontent.com/u/720953?v=3","gravatar_id":"","url":"https://api.github.com/users/olmobrutall","html_url":"https://github.com/olmobrutall","followers_url":"https://api.github.com/users/olmobrutall/followers","following_url":"https://api.github.com/users/olmobrutall/following{/other_user}","gists_url":"https://api.github.com/users/olmobrutall/gists{/gist_id}","starred_url":"https://api.github.com/users/olmobrutall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olmobrutall/subscriptions","organizations_url":"https://api.github.com/users/olmobrutall/orgs","repos_url":"https://api.github.com/users/olmobrutall/repos","events_url":"https://api.github.com/users/olmobrutall/events{/privacy}","received_events_url":"https://api.github.com/users/olmobrutall/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Question","name":"Question","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-07-12T20:47:44Z","updated_at":"2016-07-14T22:24:46Z","closed_at":null,"body":"\r\nWhenever you want to make a type optional you have to choose what value to use for the missing values: \r\n\r\n* **undefined**: Has the benefit that is already there when you don't write anything.  \r\n  * lib.d.ts contains 12 references of `| undefined`.\r\n* **null**: Familiarity, better interaction with REST Services (undefined disappears). \r\n   *  lib.d.ts contains 473 times of `| null`.* \r\n* **undefined | null**: Is too long, I was surprised that the type expression `T?` is not introduced as equivalent to `T | null | undefined`. BTW [this example](https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript#non-null-assertion-operator) is misleading.\r\n\r\nIn my opinion for most of the cases the distinction is useless as long as you use non-strict comparison (`==`. `=!`) and boolean operators ( `&&` `||`). \r\n\r\nUnfortunately writing `| null | undefined` is way too cumbersome, specially if you need have more than one optional thing in a type expression. \r\n\r\nThis is a real case: \r\n\r\n`Promise<Array<T | null | undefined> | null | undefined> | null | undefined`\r\n\r\nSome recomendations? "},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/232810340","html_url":"https://github.com/Microsoft/TypeScript/issues/9653#issuecomment-232810340","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9653","id":232810340,"user":{"login":"mhegazy","id":8000722,"avatar_url":"https://avatars.githubusercontent.com/u/8000722?v=3","gravatar_id":"","url":"https://api.github.com/users/mhegazy","html_url":"https://github.com/mhegazy","followers_url":"https://api.github.com/users/mhegazy/followers","following_url":"https://api.github.com/users/mhegazy/following{/other_user}","gists_url":"https://api.github.com/users/mhegazy/gists{/gist_id}","starred_url":"https://api.github.com/users/mhegazy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhegazy/subscriptions","organizations_url":"https://api.github.com/users/mhegazy/orgs","repos_url":"https://api.github.com/users/mhegazy/repos","events_url":"https://api.github.com/users/mhegazy/events{/privacy}","received_events_url":"https://api.github.com/users/mhegazy/received_events","type":"User","site_admin":false},"created_at":"2016-07-14T22:24:46Z","updated_at":"2016-07-14T22:24:46Z","body":"If indexers contained undefined every array access a[i] would be T | undefined. This is very annoying and would be borderline unusable."}}
{"actor":{"display_login":"mhegazy"}}