{"action":"opened","number":382,"pull_request":{"url":"https://api.github.com/repos/rematch/rematch/pulls/382","id":189783965,"html_url":"https://github.com/rematch/rematch/pull/382","diff_url":"https://github.com/rematch/rematch/pull/382.diff","patch_url":"https://github.com/rematch/rematch/pull/382.patch","issue_url":"https://api.github.com/repos/rematch/rematch/issues/382","number":382,"state":"open","locked":false,"title":"TypeScript: Add this typing for Model.effects","user":{"login":"denisw","id":1032624,"avatar_url":"https://avatars2.githubusercontent.com/u/1032624?v=4","gravatar_id":"","url":"https://api.github.com/users/denisw","html_url":"https://github.com/denisw","followers_url":"https://api.github.com/users/denisw/followers","following_url":"https://api.github.com/users/denisw/following{/other_user}","gists_url":"https://api.github.com/users/denisw/gists{/gist_id}","starred_url":"https://api.github.com/users/denisw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denisw/subscriptions","organizations_url":"https://api.github.com/users/denisw/orgs","repos_url":"https://api.github.com/users/denisw/repos","events_url":"https://api.github.com/users/denisw/events{/privacy}","received_events_url":"https://api.github.com/users/denisw/received_events","type":"User","site_admin":false},"body":"Currently, the type of `this` in `effects` functions has the same type as the `effects` function itself, leading to false errors:\r\n\r\n```ts\r\nexport const count = {\r\n  state: 0,\r\n\r\n  reducers: {\r\n    increment(state, payload) {\r\n      return state + payload\r\n    }\r\n  },\r\n\r\n  effects: {\r\n    async incrementAsync(payload, rootState) {\r\n      await new Promise(resolve => setTimeout(resolve, 1000))\r\n      this.increment(payload)  // error: parameters are incompatible with `(payload, rootState)`\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nThis change adds an explicit `this` typing for `effects` so that the methods of `this` are assumed to be `(payload: any) => any`.\r\n\r\nIdeally, the type of `this` would be so precise that it only has the methods of `reducers`, with the `state` argument removed, but I don't think this kind of recursive type definition is possible in TypeScript.","created_at":"2018-05-22T20:33:39Z","updated_at":"2018-05-22T20:33:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rematch/rematch/pulls/382/commits","review_comments_url":"https://api.github.com/repos/rematch/rematch/pulls/382/comments","review_comment_url":"https://api.github.com/repos/rematch/rematch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rematch/rematch/issues/382/comments","statuses_url":"https://api.github.com/repos/rematch/rematch/statuses/08f2c798398b42aae604b86bae1615b55d47b05d","head":{"label":"denisw:effects-this-type","ref":"effects-this-type","sha":"08f2c798398b42aae604b86bae1615b55d47b05d","user":{"login":"denisw","id":1032624,"avatar_url":"https://avatars2.githubusercontent.com/u/1032624?v=4","gravatar_id":"","url":"https://api.github.com/users/denisw","html_url":"https://github.com/denisw","followers_url":"https://api.github.com/users/denisw/followers","following_url":"https://api.github.com/users/denisw/following{/other_user}","gists_url":"https://api.github.com/users/denisw/gists{/gist_id}","starred_url":"https://api.github.com/users/denisw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denisw/subscriptions","organizations_url":"https://api.github.com/users/denisw/orgs","repos_url":"https://api.github.com/users/denisw/repos","events_url":"https://api.github.com/users/denisw/events{/privacy}","received_events_url":"https://api.github.com/users/denisw/received_events","type":"User","site_admin":false},"repo":{"id":133911810,"name":"rematch","full_name":"denisw/rematch","owner":{"login":"denisw","id":1032624,"avatar_url":"https://avatars2.githubusercontent.com/u/1032624?v=4","gravatar_id":"","url":"https://api.github.com/users/denisw","html_url":"https://github.com/denisw","followers_url":"https://api.github.com/users/denisw/followers","following_url":"https://api.github.com/users/denisw/following{/other_user}","gists_url":"https://api.github.com/users/denisw/gists{/gist_id}","starred_url":"https://api.github.com/users/denisw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denisw/subscriptions","organizations_url":"https://api.github.com/users/denisw/orgs","repos_url":"https://api.github.com/users/denisw/repos","events_url":"https://api.github.com/users/denisw/events{/privacy}","received_events_url":"https://api.github.com/users/denisw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/denisw/rematch","description":"A Redux Framework","fork":true,"url":"https://api.github.com/repos/denisw/rematch","forks_url":"https://api.github.com/repos/denisw/rematch/forks","keys_url":"https://api.github.com/repos/denisw/rematch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/denisw/rematch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/denisw/rematch/teams","hooks_url":"https://api.github.com/repos/denisw/rematch/hooks","issue_events_url":"https://api.github.com/repos/denisw/rematch/issues/events{/number}","events_url":"https://api.github.com/repos/denisw/rematch/events","assignees_url":"https://api.github.com/repos/denisw/rematch/assignees{/user}","branches_url":"https://api.github.com/repos/denisw/rematch/branches{/branch}","tags_url":"https://api.github.com/repos/denisw/rematch/tags","blobs_url":"https://api.github.com/repos/denisw/rematch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/denisw/rematch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/denisw/rematch/git/refs{/sha}","trees_url":"https://api.github.com/repos/denisw/rematch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/denisw/rematch/statuses/{sha}","languages_url":"https://api.github.com/repos/denisw/rematch/languages","stargazers_url":"https://api.github.com/repos/denisw/rematch/stargazers","contributors_url":"https://api.github.com/repos/denisw/rematch/contributors","subscribers_url":"https://api.github.com/repos/denisw/rematch/subscribers","subscription_url":"https://api.github.com/repos/denisw/rematch/subscription","commits_url":"https://api.github.com/repos/denisw/rematch/commits{/sha}","git_commits_url":"https://api.github.com/repos/denisw/rematch/git/commits{/sha}","comments_url":"https://api.github.com/repos/denisw/rematch/comments{/number}","issue_comment_url":"https://api.github.com/repos/denisw/rematch/issues/comments{/number}","contents_url":"https://api.github.com/repos/denisw/rematch/contents/{+path}","compare_url":"https://api.github.com/repos/denisw/rematch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/denisw/rematch/merges","archive_url":"https://api.github.com/repos/denisw/rematch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/denisw/rematch/downloads","issues_url":"https://api.github.com/repos/denisw/rematch/issues{/number}","pulls_url":"https://api.github.com/repos/denisw/rematch/pulls{/number}","milestones_url":"https://api.github.com/repos/denisw/rematch/milestones{/number}","notifications_url":"https://api.github.com/repos/denisw/rematch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/denisw/rematch/labels{/name}","releases_url":"https://api.github.com/repos/denisw/rematch/releases{/id}","deployments_url":"https://api.github.com/repos/denisw/rematch/deployments","created_at":"2018-05-18T06:20:36Z","updated_at":"2018-05-18T06:20:38Z","pushed_at":"2018-05-22T20:26:30Z","git_url":"git://github.com/denisw/rematch.git","ssh_url":"git@github.com:denisw/rematch.git","clone_url":"https://github.com/denisw/rematch.git","svn_url":"https://github.com/denisw/rematch","homepage":"https://rematch.gitbooks.io/rematch","size":2689,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rematch:master","ref":"master","sha":"237b822c5389599dd4dce7dcf3aa52e8fc1e9941","user":{"login":"rematch","id":32424830,"avatar_url":"https://avatars2.githubusercontent.com/u/32424830?v=4","gravatar_id":"","url":"https://api.github.com/users/rematch","html_url":"https://github.com/rematch","followers_url":"https://api.github.com/users/rematch/followers","following_url":"https://api.github.com/users/rematch/following{/other_user}","gists_url":"https://api.github.com/users/rematch/gists{/gist_id}","starred_url":"https://api.github.com/users/rematch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rematch/subscriptions","organizations_url":"https://api.github.com/users/rematch/orgs","repos_url":"https://api.github.com/users/rematch/repos","events_url":"https://api.github.com/users/rematch/events{/privacy}","received_events_url":"https://api.github.com/users/rematch/received_events","type":"Organization","site_admin":false},"repo":{"id":105411913,"name":"rematch","full_name":"rematch/rematch","owner":{"login":"rematch","id":32424830,"avatar_url":"https://avatars2.githubusercontent.com/u/32424830?v=4","gravatar_id":"","url":"https://api.github.com/users/rematch","html_url":"https://github.com/rematch","followers_url":"https://api.github.com/users/rematch/followers","following_url":"https://api.github.com/users/rematch/following{/other_user}","gists_url":"https://api.github.com/users/rematch/gists{/gist_id}","starred_url":"https://api.github.com/users/rematch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rematch/subscriptions","organizations_url":"https://api.github.com/users/rematch/orgs","repos_url":"https://api.github.com/users/rematch/repos","events_url":"https://api.github.com/users/rematch/events{/privacy}","received_events_url":"https://api.github.com/users/rematch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rematch/rematch","description":"A Redux Framework","fork":false,"url":"https://api.github.com/repos/rematch/rematch","forks_url":"https://api.github.com/repos/rematch/rematch/forks","keys_url":"https://api.github.com/repos/rematch/rematch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rematch/rematch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rematch/rematch/teams","hooks_url":"https://api.github.com/repos/rematch/rematch/hooks","issue_events_url":"https://api.github.com/repos/rematch/rematch/issues/events{/number}","events_url":"https://api.github.com/repos/rematch/rematch/events","assignees_url":"https://api.github.com/repos/rematch/rematch/assignees{/user}","branches_url":"https://api.github.com/repos/rematch/rematch/branches{/branch}","tags_url":"https://api.github.com/repos/rematch/rematch/tags","blobs_url":"https://api.github.com/repos/rematch/rematch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rematch/rematch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rematch/rematch/git/refs{/sha}","trees_url":"https://api.github.com/repos/rematch/rematch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rematch/rematch/statuses/{sha}","languages_url":"https://api.github.com/repos/rematch/rematch/languages","stargazers_url":"https://api.github.com/repos/rematch/rematch/stargazers","contributors_url":"https://api.github.com/repos/rematch/rematch/contributors","subscribers_url":"https://api.github.com/repos/rematch/rematch/subscribers","subscription_url":"https://api.github.com/repos/rematch/rematch/subscription","commits_url":"https://api.github.com/repos/rematch/rematch/commits{/sha}","git_commits_url":"https://api.github.com/repos/rematch/rematch/git/commits{/sha}","comments_url":"https://api.github.com/repos/rematch/rematch/comments{/number}","issue_comment_url":"https://api.github.com/repos/rematch/rematch/issues/comments{/number}","contents_url":"https://api.github.com/repos/rematch/rematch/contents/{+path}","compare_url":"https://api.github.com/repos/rematch/rematch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rematch/rematch/merges","archive_url":"https://api.github.com/repos/rematch/rematch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rematch/rematch/downloads","issues_url":"https://api.github.com/repos/rematch/rematch/issues{/number}","pulls_url":"https://api.github.com/repos/rematch/rematch/pulls{/number}","milestones_url":"https://api.github.com/repos/rematch/rematch/milestones{/number}","notifications_url":"https://api.github.com/repos/rematch/rematch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rematch/rematch/labels{/name}","releases_url":"https://api.github.com/repos/rematch/rematch/releases{/id}","deployments_url":"https://api.github.com/repos/rematch/rematch/deployments","created_at":"2017-10-01T01:29:27Z","updated_at":"2018-05-22T20:06:25Z","pushed_at":"2018-05-21T18:17:23Z","git_url":"git://github.com/rematch/rematch.git","ssh_url":"git@github.com:rematch/rematch.git","clone_url":"https://github.com/rematch/rematch.git","svn_url":"https://github.com/rematch/rematch","homepage":"https://rematch.gitbooks.io/rematch","size":2706,"stargazers_count":3500,"watchers_count":3500,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":115,"mirror_url":null,"archived":false,"open_issues_count":33,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":115,"open_issues":33,"watchers":3500,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rematch/rematch/pulls/382"},"html":{"href":"https://github.com/rematch/rematch/pull/382"},"issue":{"href":"https://api.github.com/repos/rematch/rematch/issues/382"},"comments":{"href":"https://api.github.com/repos/rematch/rematch/issues/382/comments"},"review_comments":{"href":"https://api.github.com/repos/rematch/rematch/pulls/382/comments"},"review_comment":{"href":"https://api.github.com/repos/rematch/rematch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rematch/rematch/pulls/382/commits"},"statuses":{"href":"https://api.github.com/repos/rematch/rematch/statuses/08f2c798398b42aae604b86bae1615b55d47b05d"}},"author_association":"CONTRIBUTOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":5,"deletions":1,"changed_files":1}}
{"actor":{"display_login":"denisw"}}