{"action":"closed","number":12635,"pull_request":{"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/12635","id":93434269,"html_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/12635","diff_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/12635.diff","patch_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/12635.patch","issue_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/12635","number":12635,"state":"closed","locked":false,"title":"More accurate hinted and inferred types for react-redux connect()","user":{"login":"rockmacaca","id":4993980,"avatar_url":"https://avatars.githubusercontent.com/u/4993980?v=3","gravatar_id":"","url":"https://api.github.com/users/rockmacaca","html_url":"https://github.com/rockmacaca","followers_url":"https://api.github.com/users/rockmacaca/followers","following_url":"https://api.github.com/users/rockmacaca/following{/other_user}","gists_url":"https://api.github.com/users/rockmacaca/gists{/gist_id}","starred_url":"https://api.github.com/users/rockmacaca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rockmacaca/subscriptions","organizations_url":"https://api.github.com/users/rockmacaca/orgs","repos_url":"https://api.github.com/users/rockmacaca/repos","events_url":"https://api.github.com/users/rockmacaca/events{/privacy}","received_events_url":"https://api.github.com/users/rockmacaca/received_events","type":"User","site_admin":false},"body":"First of all, sorry I ended up reformatting most of the code in the process of this PR. The tests were getting to be very disorganized, and I wanted the way the way the typings are exported to be consistent with how the typings are defined in React and Redux. I can try to reimplement my changes without messing with the formatting too much if this is a problem.\r\n\r\nAnyway, I found quite a few problems with how `connect` was being inferred. Namely, calling `connect()` with no arguments would result in a type that was exactly the same as the class being wrapped. Merged properties were also slightly incorrect, and there was no way for the user to define the type that the final merged properties would have. Also, when `connect` is called _with_ arguments, static members wouldn't be accessible since the type was just `ComponentClass<P>`. These should all be resolved with this PR.\r\n\r\nLastly, I made the tests stricter, and I also provided an example of using the `@connect` decorator with explicit types (not just cheating by using `any`!)\r\n\r\nThey only breaking change with this is that for whatever reason, `TOwnProps` sometimes can't be inferred in JSX, but it's fine in `React.createElement`. I've added a single type param version of `connect` to compensate for this.\r\n\r\n- [x] Prefer to make your PR against the `types-2.0` branch.\r\n- [x] Test the change in your own code.\r\n- [x] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped#make-a-pull-request).\r\n- [x] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped#common-mistakes).\r\n\r\nIf adding a new definition:\r\n- [ ] The package does not provide its own types, and you can not add them.\r\n- [ ] If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package.\r\n- [ ] Run `tsc` without errors.\r\n- [ ] Include the required [files](https://github.com/DefinitelyTyped/DefinitelyTyped#create-a-new-package) and header. Base these on the README, *not* on an existing project.\r\n\r\nIf changing an existing definition:\r\n- [ ] Provide a URL to  documentation or source code which provides context for the suggested changes: <<url here>>\r\n- [ ] Increase the version number in the header if appropriate.\r\n\r\n- Cleaned up and made the typings and tests consistent stylewise\r\n- Support typings for the mergeProps parameter\r\n- Allow mapStateToProps and mapDispatchToProps to be optional when type parameters are provided\r\n- Make static members accessible on the wrapped component\r\n- Use stricter typings in the quick start counter tests\r\n- Added a single type variable form for connect to specify TOwnProps","created_at":"2016-11-12T09:53:59Z","updated_at":"2016-11-22T19:42:13Z","closed_at":"2016-11-22T19:42:13Z","merged_at":"2016-11-22T19:42:13Z","merge_commit_sha":"66dbcdff27beb585e2ad229bf219ccaf9226697c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/12635/commits","review_comments_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/12635/comments","review_comment_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/12635/comments","statuses_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/statuses/27b98d0580fd39f4b99041191ee57373c71998c5","head":{"label":"rockmacaca:types-2.0-react-redux","ref":"types-2.0-react-redux","sha":"27b98d0580fd39f4b99041191ee57373c71998c5","user":{"login":"rockmacaca","id":4993980,"avatar_url":"https://avatars.githubusercontent.com/u/4993980?v=3","gravatar_id":"","url":"https://api.github.com/users/rockmacaca","html_url":"https://github.com/rockmacaca","followers_url":"https://api.github.com/users/rockmacaca/followers","following_url":"https://api.github.com/users/rockmacaca/following{/other_user}","gists_url":"https://api.github.com/users/rockmacaca/gists{/gist_id}","starred_url":"https://api.github.com/users/rockmacaca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rockmacaca/subscriptions","organizations_url":"https://api.github.com/users/rockmacaca/orgs","repos_url":"https://api.github.com/users/rockmacaca/repos","events_url":"https://api.github.com/users/rockmacaca/events{/privacy}","received_events_url":"https://api.github.com/users/rockmacaca/received_events","type":"User","site_admin":false},"repo":{"id":73037247,"name":"DefinitelyTyped","full_name":"rockmacaca/DefinitelyTyped","owner":{"login":"rockmacaca","id":4993980,"avatar_url":"https://avatars.githubusercontent.com/u/4993980?v=3","gravatar_id":"","url":"https://api.github.com/users/rockmacaca","html_url":"https://github.com/rockmacaca","followers_url":"https://api.github.com/users/rockmacaca/followers","following_url":"https://api.github.com/users/rockmacaca/following{/other_user}","gists_url":"https://api.github.com/users/rockmacaca/gists{/gist_id}","starred_url":"https://api.github.com/users/rockmacaca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rockmacaca/subscriptions","organizations_url":"https://api.github.com/users/rockmacaca/orgs","repos_url":"https://api.github.com/users/rockmacaca/repos","events_url":"https://api.github.com/users/rockmacaca/events{/privacy}","received_events_url":"https://api.github.com/users/rockmacaca/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rockmacaca/DefinitelyTyped","description":"The repository for high quality TypeScript type definitions.","fork":true,"url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped","forks_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/forks","keys_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/teams","hooks_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/hooks","issue_events_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/issues/events{/number}","events_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/events","assignees_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/assignees{/user}","branches_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/branches{/branch}","tags_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/tags","blobs_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/git/refs{/sha}","trees_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/statuses/{sha}","languages_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/languages","stargazers_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/stargazers","contributors_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/contributors","subscribers_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/subscribers","subscription_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/subscription","commits_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/commits{/sha}","git_commits_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/git/commits{/sha}","comments_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/comments{/number}","issue_comment_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/issues/comments{/number}","contents_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/contents/{+path}","compare_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/merges","archive_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/downloads","issues_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/issues{/number}","pulls_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/pulls{/number}","milestones_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/milestones{/number}","notifications_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/labels{/name}","releases_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/releases{/id}","deployments_url":"https://api.github.com/repos/rockmacaca/DefinitelyTyped/deployments","created_at":"2016-11-07T03:00:34Z","updated_at":"2016-11-07T03:00:44Z","pushed_at":"2016-11-15T00:32:55Z","git_url":"git://github.com/rockmacaca/DefinitelyTyped.git","ssh_url":"git@github.com:rockmacaca/DefinitelyTyped.git","clone_url":"https://github.com/rockmacaca/DefinitelyTyped.git","svn_url":"https://github.com/rockmacaca/DefinitelyTyped","homepage":"http://definitelytyped.org/","size":144422,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"DefinitelyTyped:types-2.0","ref":"types-2.0","sha":"c810dc61a95826416bdbf7eaab370f78eb9e0acd","user":{"login":"DefinitelyTyped","id":3637556,"avatar_url":"https://avatars.githubusercontent.com/u/3637556?v=3","gravatar_id":"","url":"https://api.github.com/users/DefinitelyTyped","html_url":"https://github.com/DefinitelyTyped","followers_url":"https://api.github.com/users/DefinitelyTyped/followers","following_url":"https://api.github.com/users/DefinitelyTyped/following{/other_user}","gists_url":"https://api.github.com/users/DefinitelyTyped/gists{/gist_id}","starred_url":"https://api.github.com/users/DefinitelyTyped/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DefinitelyTyped/subscriptions","organizations_url":"https://api.github.com/users/DefinitelyTyped/orgs","repos_url":"https://api.github.com/users/DefinitelyTyped/repos","events_url":"https://api.github.com/users/DefinitelyTyped/events{/privacy}","received_events_url":"https://api.github.com/users/DefinitelyTyped/received_events","type":"Organization","site_admin":false},"repo":{"id":6093316,"name":"DefinitelyTyped","full_name":"DefinitelyTyped/DefinitelyTyped","owner":{"login":"DefinitelyTyped","id":3637556,"avatar_url":"https://avatars.githubusercontent.com/u/3637556?v=3","gravatar_id":"","url":"https://api.github.com/users/DefinitelyTyped","html_url":"https://github.com/DefinitelyTyped","followers_url":"https://api.github.com/users/DefinitelyTyped/followers","following_url":"https://api.github.com/users/DefinitelyTyped/following{/other_user}","gists_url":"https://api.github.com/users/DefinitelyTyped/gists{/gist_id}","starred_url":"https://api.github.com/users/DefinitelyTyped/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DefinitelyTyped/subscriptions","organizations_url":"https://api.github.com/users/DefinitelyTyped/orgs","repos_url":"https://api.github.com/users/DefinitelyTyped/repos","events_url":"https://api.github.com/users/DefinitelyTyped/events{/privacy}","received_events_url":"https://api.github.com/users/DefinitelyTyped/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DefinitelyTyped/DefinitelyTyped","description":"The repository for high quality TypeScript type definitions.","fork":false,"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped","forks_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/forks","keys_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/teams","hooks_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/hooks","issue_events_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/events{/number}","events_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/events","assignees_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/assignees{/user}","branches_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/branches{/branch}","tags_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/tags","blobs_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/git/refs{/sha}","trees_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/statuses/{sha}","languages_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/languages","stargazers_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/stargazers","contributors_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/contributors","subscribers_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/subscribers","subscription_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/subscription","commits_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/commits{/sha}","git_commits_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/git/commits{/sha}","comments_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/comments{/number}","issue_comment_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/comments{/number}","contents_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/contents/{+path}","compare_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/merges","archive_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/downloads","issues_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues{/number}","pulls_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls{/number}","milestones_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/milestones{/number}","notifications_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/labels{/name}","releases_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/releases{/id}","deployments_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/deployments","created_at":"2012-10-05T16:39:45Z","updated_at":"2016-11-22T13:54:21Z","pushed_at":"2016-11-22T19:42:13Z","git_url":"git://github.com/DefinitelyTyped/DefinitelyTyped.git","ssh_url":"git@github.com:DefinitelyTyped/DefinitelyTyped.git","clone_url":"https://github.com/DefinitelyTyped/DefinitelyTyped.git","svn_url":"https://github.com/DefinitelyTyped/DefinitelyTyped","homepage":"http://definitelytyped.org/","size":244328,"stargazers_count":8981,"watchers_count":8981,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7128,"mirror_url":null,"open_issues_count":1249,"forks":7128,"open_issues":1249,"watchers":8981,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/12635"},"html":{"href":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/12635"},"issue":{"href":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/12635"},"comments":{"href":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/12635/comments"},"review_comments":{"href":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/12635/comments"},"review_comment":{"href":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/12635/commits"},"statuses":{"href":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/statuses/27b98d0580fd39f4b99041191ee57373c71998c5"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"sandersn","id":293473,"avatar_url":"https://avatars.githubusercontent.com/u/293473?v=3","gravatar_id":"","url":"https://api.github.com/users/sandersn","html_url":"https://github.com/sandersn","followers_url":"https://api.github.com/users/sandersn/followers","following_url":"https://api.github.com/users/sandersn/following{/other_user}","gists_url":"https://api.github.com/users/sandersn/gists{/gist_id}","starred_url":"https://api.github.com/users/sandersn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandersn/subscriptions","organizations_url":"https://api.github.com/users/sandersn/orgs","repos_url":"https://api.github.com/users/sandersn/repos","events_url":"https://api.github.com/users/sandersn/events{/privacy}","received_events_url":"https://api.github.com/users/sandersn/received_events","type":"User","site_admin":false},"comments":3,"review_comments":7,"commits":1,"additions":378,"deletions":337,"changed_files":2}}
{"actor":{"display_login":"sandersn"}}