{"action":"closed","issue":{"url":"https://api.github.com/repos/buildo/react-avenger/issues/52","repository_url":"https://api.github.com/repos/buildo/react-avenger","labels_url":"https://api.github.com/repos/buildo/react-avenger/issues/52/labels{/name}","comments_url":"https://api.github.com/repos/buildo/react-avenger/issues/52/comments","events_url":"https://api.github.com/repos/buildo/react-avenger/issues/52/events","html_url":"https://github.com/buildo/react-avenger/issues/52","id":304315919,"number":52,"title":"improve type safety of query value & readyState","user":{"login":"giogonzo","id":2643520,"avatar_url":"https://avatars2.githubusercontent.com/u/2643520?v=4","gravatar_id":"","url":"https://api.github.com/users/giogonzo","html_url":"https://github.com/giogonzo","followers_url":"https://api.github.com/users/giogonzo/followers","following_url":"https://api.github.com/users/giogonzo/following{/other_user}","gists_url":"https://api.github.com/users/giogonzo/gists{/gist_id}","starred_url":"https://api.github.com/users/giogonzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giogonzo/subscriptions","organizations_url":"https://api.github.com/users/giogonzo/orgs","repos_url":"https://api.github.com/users/giogonzo/repos","events_url":"https://api.github.com/users/giogonzo/events{/privacy}","received_events_url":"https://api.github.com/users/giogonzo/received_events","type":"User","site_admin":false},"labels":[{"id":524130738,"url":"https://api.github.com/repos/buildo/react-avenger/labels/breaking","name":"breaking","color":"e99695","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-12T10:30:30Z","updated_at":"2018-03-16T15:39:35Z","closed_at":"2018-03-16T15:39:35Z","author_association":"OWNER","body":"## requirements\r\ncurrently, there's no way for TS to tell that when `readyState.ready` si false, the value of a query is undefined, and viceversa.\r\nThis can be improved so that, e.g. in a render method:\r\n```tsx\r\nif (readyState.foo.ready) {\r\n  // `foo` is known to be defined by TS here\r\n}\r\n```\r\nrationale: \"making illegal states unrepresentable\"\r\n\r\n## specs\r\nkill the top level `readyState` prop and instead pass down (for each query prop) something like:\r\n```tsx\r\n{\r\n  foo: ({\r\n    ready: true,\r\n    value: T\r\n  } | {\r\n    ready: false\r\n  }) & {\r\n    loading: boolean\r\n  }\r\n}\r\n```\r\n\r\n## misc\r\n{optional: other useful info}\r\n"}}
{"actor":{"display_login":"giogonzo"}}