{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments/100455963","pull_request_review_id":21164152,"id":100455963,"diff_hunk":"@@ -18323,16 +18478,110 @@ namespace ts {\n             if (symbol.declarations.length === 1) {\r\n                 return;\r\n             }\r\n-            let firstDecl: ClassLikeDeclaration | InterfaceDeclaration;\r\n-            for (const declaration of symbol.declarations) {\r\n-                if (declaration.kind === SyntaxKind.ClassDeclaration || declaration.kind === SyntaxKind.InterfaceDeclaration) {\r\n-                    if (!firstDecl) {\r\n-                        firstDecl = <ClassLikeDeclaration | InterfaceDeclaration>declaration;\r\n-                    }\r\n-                    else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) {\r\n-                        error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text);\r\n+\r\n+            // Resolve the type parameters and minimum type argument count for all declarations\r\n+            resolveTypeParametersOfClassOrInterface(symbol);\r","path":"src/compiler/checker.ts","position":null,"original_position":525,"commit_id":"96181c023b98e6feede6e8b7477abb3709215051","original_commit_id":"e0012587f5abca75d386e4e6f48a3a02a986fed5","user":{"login":"rbuckton","id":3902892,"avatar_url":"https://avatars.githubusercontent.com/u/3902892?v=3","gravatar_id":"","url":"https://api.github.com/users/rbuckton","html_url":"https://github.com/rbuckton","followers_url":"https://api.github.com/users/rbuckton/followers","following_url":"https://api.github.com/users/rbuckton/following{/other_user}","gists_url":"https://api.github.com/users/rbuckton/gists{/gist_id}","starred_url":"https://api.github.com/users/rbuckton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbuckton/subscriptions","organizations_url":"https://api.github.com/users/rbuckton/orgs","repos_url":"https://api.github.com/users/rbuckton/repos","events_url":"https://api.github.com/users/rbuckton/events{/privacy}","received_events_url":"https://api.github.com/users/rbuckton/received_events","type":"User","site_admin":false},"body":"This should be much simpler and relatively straightforward now based on our offline discussion.","created_at":"2017-02-10T01:37:47Z","updated_at":"2017-02-10T01:37:47Z","html_url":"https://github.com/Microsoft/TypeScript/pull/13487#discussion_r100455963","pull_request_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/13487","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments/100455963"},"html":{"href":"https://github.com/Microsoft/TypeScript/pull/13487#discussion_r100455963"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/13487"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/13487","id":101553268,"html_url":"https://github.com/Microsoft/TypeScript/pull/13487","diff_url":"https://github.com/Microsoft/TypeScript/pull/13487.diff","patch_url":"https://github.com/Microsoft/TypeScript/pull/13487.patch","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/13487","number":13487,"state":"open","locked":false,"title":"Adds support for type parameter defaults","user":{"login":"rbuckton","id":3902892,"avatar_url":"https://avatars.githubusercontent.com/u/3902892?v=3","gravatar_id":"","url":"https://api.github.com/users/rbuckton","html_url":"https://github.com/rbuckton","followers_url":"https://api.github.com/users/rbuckton/followers","following_url":"https://api.github.com/users/rbuckton/following{/other_user}","gists_url":"https://api.github.com/users/rbuckton/gists{/gist_id}","starred_url":"https://api.github.com/users/rbuckton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbuckton/subscriptions","organizations_url":"https://api.github.com/users/rbuckton/orgs","repos_url":"https://api.github.com/users/rbuckton/repos","events_url":"https://api.github.com/users/rbuckton/events{/privacy}","received_events_url":"https://api.github.com/users/rbuckton/received_events","type":"User","site_admin":false},"body":"This PR adds support for defaults for generic type parameters and replaces #6354 as it is fairly out of date. \r\n\r\nDefault types for generic type parameters have the following syntax:\r\n\r\n```grammarkdown\r\nTypeParameter :\r\n  BindingIdentifier Constraint? DefaultType?\r\n\r\nDefaultType :\r\n  `=` Type\r\n```\r\n\r\nDefault types have the following rules:\r\n\r\n* Required type parameters must not follow optional type parameters.\r\n* When the checker applies defaults for type parameters, they are applied from left to right:\r\n  * If the default for a type parameter refers to a type parameter that occurs earlier in the list, the type argument for that parameter will be used.\r\n  * If the default for a type parameter refers to a type parameter that occurs later in the list, the empty object type `{}` will be used. \r\n  * *NOTE: This helps to avoid the cost of a circularity check for defaults.*\r\n* Default types for a type parameter must satisfy the constraint for the type parameter, if it exists.\r\n* A class or interface declaration that merges with an existing class or interface declaration may introduce a default for an existing type parameter.\r\n* A class or interface declaration that merges with an existing class or interface declaration may introduce a new type parameter as long as it specifies a default.\r\n* When resolving a symbol with the same name as a Type Parameter introduced in a merged declaration, the type parameter will not be considered and resolution will continue on to the next container.\r\n* When specifying type arguments, you are only required to specify type arguments for the required type parameters. Unspecified type parameters will resolve to their default types.\r\n* If a default type is not specified and inference cannot choose a candidate, the empty object type `{}` is inferred. *This is the existing behvaior.*\r\n* If a default type is specified and inference cannot chose a candidate, the default type is inferred.\r\n\r\nThis PR also updates the signature for `Promise<T>` and `PromiseLike<T>` to take full advantage of the new support for type parameter defaults.\r\n\r\nFixes #2175\r\nFixes #10977\r\nFixes #12725 \r\nFixes #12886\r\nFixes #12910\r\nFixes #13008\r\nFixes #13015 \r\nFixes #13117 \r\n\r\n","created_at":"2017-01-14T07:15:32Z","updated_at":"2017-02-10T01:37:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7725db62ff9530333dbda4edaa1dbe037b20a3f8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/13487/commits","review_comments_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/13487/comments","review_comment_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/13487/comments","statuses_url":"https://api.github.com/repos/Microsoft/TypeScript/statuses/96181c023b98e6feede6e8b7477abb3709215051","head":{"label":"Microsoft:genericDefaults","ref":"genericDefaults","sha":"96181c023b98e6feede6e8b7477abb3709215051","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":20929025,"name":"TypeScript","full_name":"Microsoft/TypeScript","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/TypeScript","description":"TypeScript is a superset of JavaScript that compiles to clean JavaScript output.","fork":false,"url":"https://api.github.com/repos/Microsoft/TypeScript","forks_url":"https://api.github.com/repos/Microsoft/TypeScript/forks","keys_url":"https://api.github.com/repos/Microsoft/TypeScript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/TypeScript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/TypeScript/teams","hooks_url":"https://api.github.com/repos/Microsoft/TypeScript/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/TypeScript/events","assignees_url":"https://api.github.com/repos/Microsoft/TypeScript/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/TypeScript/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/TypeScript/tags","blobs_url":"https://api.github.com/repos/Microsoft/TypeScript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/TypeScript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/TypeScript/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/TypeScript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/TypeScript/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/TypeScript/languages","stargazers_url":"https://api.github.com/repos/Microsoft/TypeScript/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/TypeScript/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/TypeScript/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/TypeScript/subscription","commits_url":"https://api.github.com/repos/Microsoft/TypeScript/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/TypeScript/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/TypeScript/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/TypeScript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/TypeScript/merges","archive_url":"https://api.github.com/repos/Microsoft/TypeScript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/TypeScript/downloads","issues_url":"https://api.github.com/repos/Microsoft/TypeScript/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/TypeScript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/TypeScript/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/TypeScript/deployments","created_at":"2014-06-17T15:28:39Z","updated_at":"2017-02-10T01:12:43Z","pushed_at":"2017-02-10T01:36:35Z","git_url":"git://github.com/Microsoft/TypeScript.git","ssh_url":"git@github.com:Microsoft/TypeScript.git","clone_url":"https://github.com/Microsoft/TypeScript.git","svn_url":"https://github.com/Microsoft/TypeScript","homepage":"http://www.typescriptlang.org","size":344195,"stargazers_count":18878,"watchers_count":18878,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2680,"mirror_url":null,"open_issues_count":1989,"forks":2680,"open_issues":1989,"watchers":18878,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"df643d8d02cc91993fde3d2a801817b78ecaa504","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":20929025,"name":"TypeScript","full_name":"Microsoft/TypeScript","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/TypeScript","description":"TypeScript is a superset of JavaScript that compiles to clean JavaScript output.","fork":false,"url":"https://api.github.com/repos/Microsoft/TypeScript","forks_url":"https://api.github.com/repos/Microsoft/TypeScript/forks","keys_url":"https://api.github.com/repos/Microsoft/TypeScript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/TypeScript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/TypeScript/teams","hooks_url":"https://api.github.com/repos/Microsoft/TypeScript/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/TypeScript/events","assignees_url":"https://api.github.com/repos/Microsoft/TypeScript/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/TypeScript/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/TypeScript/tags","blobs_url":"https://api.github.com/repos/Microsoft/TypeScript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/TypeScript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/TypeScript/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/TypeScript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/TypeScript/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/TypeScript/languages","stargazers_url":"https://api.github.com/repos/Microsoft/TypeScript/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/TypeScript/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/TypeScript/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/TypeScript/subscription","commits_url":"https://api.github.com/repos/Microsoft/TypeScript/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/TypeScript/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/TypeScript/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/TypeScript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/TypeScript/merges","archive_url":"https://api.github.com/repos/Microsoft/TypeScript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/TypeScript/downloads","issues_url":"https://api.github.com/repos/Microsoft/TypeScript/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/TypeScript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/TypeScript/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/TypeScript/deployments","created_at":"2014-06-17T15:28:39Z","updated_at":"2017-02-10T01:12:43Z","pushed_at":"2017-02-10T01:36:35Z","git_url":"git://github.com/Microsoft/TypeScript.git","ssh_url":"git@github.com:Microsoft/TypeScript.git","clone_url":"https://github.com/Microsoft/TypeScript.git","svn_url":"https://github.com/Microsoft/TypeScript","homepage":"http://www.typescriptlang.org","size":344195,"stargazers_count":18878,"watchers_count":18878,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2680,"mirror_url":null,"open_issues_count":1989,"forks":2680,"open_issues":1989,"watchers":18878,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/13487"},"html":{"href":"https://github.com/Microsoft/TypeScript/pull/13487"},"issue":{"href":"https://api.github.com/repos/Microsoft/TypeScript/issues/13487"},"comments":{"href":"https://api.github.com/repos/Microsoft/TypeScript/issues/13487/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/13487/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/13487/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/TypeScript/statuses/96181c023b98e6feede6e8b7477abb3709215051"}}}}
{"actor":{"display_login":"rbuckton"}}