{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/flow/issues/375","labels_url":"https://api.github.com/repos/facebook/flow/issues/375/labels{/name}","comments_url":"https://api.github.com/repos/facebook/flow/issues/375/comments","events_url":"https://api.github.com/repos/facebook/flow/issues/375/events","html_url":"https://github.com/facebook/flow/issues/375","id":67876282,"number":375,"title":"Null-only type annotation","user":{"login":"popham","id":1271170,"avatar_url":"https://avatars.githubusercontent.com/u/1271170?v=3","gravatar_id":"","url":"https://api.github.com/users/popham","html_url":"https://github.com/popham","followers_url":"https://api.github.com/users/popham/followers","following_url":"https://api.github.com/users/popham/following{/other_user}","gists_url":"https://api.github.com/users/popham/gists{/gist_id}","starred_url":"https://api.github.com/users/popham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/popham/subscriptions","organizations_url":"https://api.github.com/users/popham/orgs","repos_url":"https://api.github.com/users/popham/repos","events_url":"https://api.github.com/users/popham/events{/privacy}","received_events_url":"https://api.github.com/users/popham/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-12T05:56:08Z","updated_at":"2015-04-25T00:05:31Z","closed_at":null,"body":"I've got a generic class that I want to parametrize by `null`:\r\n\r\n```\r\nclass List<T> {\r\n  get(index: uint32): T {  throw new Error(\"Not implemented\"); }\r\n  // Map, For Each, Reduce, etc. (`core/lib`'s `Array` analogues)\r\n}\r\n```\r\n\r\n```\r\nclass NullList extends List<null> { // NG\r\n  get(index) {\r\n    if (this.isOutside(index)) throw new RangeError();\r\n    return null;\r\n  }\r\n}\r\n```\r\n\r\nI'll grant that the `NullList` is a boring edge case.  For now I'm vacillating between a `NullList` implementation with `T=void` + `return undefined` and defering to the base class's `get`.  Have I missed a mechanism to specify a null-only type?"},"comment":{"url":"https://api.github.com/repos/facebook/flow/issues/comments/96104036","html_url":"https://github.com/facebook/flow/issues/375#issuecomment-96104036","issue_url":"https://api.github.com/repos/facebook/flow/issues/375","id":96104036,"user":{"login":"samwgoldman","id":254842,"avatar_url":"https://avatars.githubusercontent.com/u/254842?v=3","gravatar_id":"","url":"https://api.github.com/users/samwgoldman","html_url":"https://github.com/samwgoldman","followers_url":"https://api.github.com/users/samwgoldman/followers","following_url":"https://api.github.com/users/samwgoldman/following{/other_user}","gists_url":"https://api.github.com/users/samwgoldman/gists{/gist_id}","starred_url":"https://api.github.com/users/samwgoldman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samwgoldman/subscriptions","organizations_url":"https://api.github.com/users/samwgoldman/orgs","repos_url":"https://api.github.com/users/samwgoldman/repos","events_url":"https://api.github.com/users/samwgoldman/events{/privacy}","received_events_url":"https://api.github.com/users/samwgoldman/received_events","type":"User","site_admin":false},"created_at":"2015-04-25T00:05:31Z","updated_at":"2015-04-25T00:05:31Z","body":"This seems like a decent beginner bug to me, but I'm curious why `T=void` + `return` is insufficient. It seems more idiomatic to me."}}