{"action":"created","comment":{"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/comments/167656654","pull_request_review_id":95904330,"id":167656654,"diff_hunk":"@@ -160,7 +168,17 @@ export interface Feature<G extends GeometryObject, P = GeoJsonProperties> extend\n  * A collection of feature objects.\n  *  https://tools.ietf.org/html/rfc7946#section-3.3\n  */\n-export interface FeatureCollection<G extends GeometryObject, P = GeoJsonProperties> extends GeoJsonObject {\n+export interface FeatureCollection<G extends GeometryObject = GeometryObject, P = GeoJsonProperties> extends BaseGeoJsonObject {\n     type: \"FeatureCollection\";\n     features: Array<Feature<G, P>>;\n }\n+\n+/**\n+ * GeoJSON object to be used when accepting aribtrary GeoJSON\n+ * https://tools.ietf.org/html/rfc7946#section-3\n+ * The GeoJSON specification also allows foreign members","path":"types/geojson/index.d.ts","position":126,"original_position":126,"commit_id":"84771dc5ce3d4ff50aa9be3df40d3b271c46398c","original_commit_id":"84771dc5ce3d4ff50aa9be3df40d3b271c46398c","user":{"login":"atd-schubert","id":3003802,"avatar_url":"https://avatars2.githubusercontent.com/u/3003802?v=4","gravatar_id":"","url":"https://api.github.com/users/atd-schubert","html_url":"https://github.com/atd-schubert","followers_url":"https://api.github.com/users/atd-schubert/followers","following_url":"https://api.github.com/users/atd-schubert/following{/other_user}","gists_url":"https://api.github.com/users/atd-schubert/gists{/gist_id}","starred_url":"https://api.github.com/users/atd-schubert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atd-schubert/subscriptions","organizations_url":"https://api.github.com/users/atd-schubert/orgs","repos_url":"https://api.github.com/users/atd-schubert/repos","events_url":"https://api.github.com/users/atd-schubert/events{/privacy}","received_events_url":"https://api.github.com/users/atd-schubert/received_events","type":"User","site_admin":false},"body":"Where do you see the advantage of this more specified type definition? Keep in mind that it is allowed to add foreign members...","created_at":"2018-02-12T19:12:16Z","updated_at":"2018-02-12T19:12:26Z","html_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/23268#discussion_r167656654","pull_request_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/23268","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/comments/167656654"},"html":{"href":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/23268#discussion_r167656654"},"pull_request":{"href":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/23268"}}},"pull_request":{"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/23268","id":165840408,"html_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/23268","diff_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/23268.diff","patch_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/23268.patch","issue_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/23268","number":23268,"state":"open","locked":false,"title":"GeoJSON: default generics; switch type inference","user":{"login":"jambonrose","id":2659203,"avatar_url":"https://avatars0.githubusercontent.com/u/2659203?v=4","gravatar_id":"","url":"https://api.github.com/users/jambonrose","html_url":"https://github.com/jambonrose","followers_url":"https://api.github.com/users/jambonrose/followers","following_url":"https://api.github.com/users/jambonrose/following{/other_user}","gists_url":"https://api.github.com/users/jambonrose/gists{/gist_id}","starred_url":"https://api.github.com/users/jambonrose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jambonrose/subscriptions","organizations_url":"https://api.github.com/users/jambonrose/orgs","repos_url":"https://api.github.com/users/jambonrose/repos","events_url":"https://api.github.com/users/jambonrose/events{/privacy}","received_events_url":"https://api.github.com/users/jambonrose/received_events","type":"User","site_admin":false},"body":"- [X] Use a meaningful title for the pull request. Include the name of the package modified.\r\n- [X] Test the change in your own code. (Compile and run.)\r\n- [X] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request).\r\n- [X] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes).\r\n- [X] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present).\r\n\r\nThis PR seeks out to do two things:\r\n\r\n- allow for `Feature` and `FeatureCollection` to be used with defaults (`Feature` instead of `Feature<GeometryObject>`)\r\n- allow Typescript to infer types of `GeoJsonObjects` in switch statements\r\n\r\nAt the moment, the following code in Typescript will error.\r\n\r\n```typescript\r\nexport const extractCoordsFromGeoJSON = (geojson: GeoJsonObject): Position[][][][] => {\r\n  switch (geojson.type) {\r\n    case 'GeometryCollection':\r\n      return geojson.geometries.map(extractCoordsFromGeoJSON)\r\n    case 'Feature':\r\n      return extractCoordsFromGeoJSON(geojson.geometry)\r\n    case 'FeatureCollection':\r\n      return geojson.features.map(extractCoordsFromGeoJSON)\r\n    case 'Polygon':\r\n      return [[geojson.coordinates.slice(0, 2)]]\r\n    case 'MultiPolygon':\r\n      return [geojson.coordinates.slice(0, 2)]\r\n  }\r\n}\r\n```\r\n\r\n\r\nThe errors in question are printed below.\r\n\r\n```\r\nProperty 'geometries' does not exist on type 'GeoJsonObject'.\r\nProperty 'geometry' does not exist on type 'GeoJsonObject'.\r\nProperty 'features' does not exist on type 'GeoJsonObject'.\r\nProperty 'coordinates' does not exist on type 'GeoJsonObject'.\r\nProperty 'coordinates' does not exist on type 'GeoJsonObject'.\r\n```\r\n\r\nThe goal is to allow the switch statement to work without needing to introduce more code (such as type narrowers/guards).\r\n\r\nWe change `GeoJsonObject` so that it is the union of the various types, rather than the base interface being extended. The code above is included as a new test.","created_at":"2018-01-29T22:50:53Z","updated_at":"2018-02-12T19:12:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d60ebb0d10cbeb502821d8744c0c742a152a28e2","assignee":null,"assignees":[],"requested_reviewers":[{"login":"borisyankov","id":867242,"avatar_url":"https://avatars3.githubusercontent.com/u/867242?v=4","gravatar_id":"","url":"https://api.github.com/users/borisyankov","html_url":"https://github.com/borisyankov","followers_url":"https://api.github.com/users/borisyankov/followers","following_url":"https://api.github.com/users/borisyankov/following{/other_user}","gists_url":"https://api.github.com/users/borisyankov/gists{/gist_id}","starred_url":"https://api.github.com/users/borisyankov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/borisyankov/subscriptions","organizations_url":"https://api.github.com/users/borisyankov/orgs","repos_url":"https://api.github.com/users/borisyankov/repos","events_url":"https://api.github.com/users/borisyankov/events{/privacy}","received_events_url":"https://api.github.com/users/borisyankov/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":397523192,"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/labels/Awaiting%20reviewer%20feedback","name":"Awaiting reviewer feedback","color":"0052cc","default":false},{"id":644095882,"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/labels/Merge:YSYL","name":"Merge:YSYL","color":"bfdadc","default":false},{"id":684321576,"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/labels/Popular%20package","name":"Popular package","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/23268/commits","review_comments_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/23268/comments","review_comment_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/23268/comments","statuses_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/statuses/84771dc5ce3d4ff50aa9be3df40d3b271c46398c","head":{"label":"jambonsw:enable_geojson_switch_statement","ref":"enable_geojson_switch_statement","sha":"84771dc5ce3d4ff50aa9be3df40d3b271c46398c","user":{"login":"jambonsw","id":16246134,"avatar_url":"https://avatars0.githubusercontent.com/u/16246134?v=4","gravatar_id":"","url":"https://api.github.com/users/jambonsw","html_url":"https://github.com/jambonsw","followers_url":"https://api.github.com/users/jambonsw/followers","following_url":"https://api.github.com/users/jambonsw/following{/other_user}","gists_url":"https://api.github.com/users/jambonsw/gists{/gist_id}","starred_url":"https://api.github.com/users/jambonsw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jambonsw/subscriptions","organizations_url":"https://api.github.com/users/jambonsw/orgs","repos_url":"https://api.github.com/users/jambonsw/repos","events_url":"https://api.github.com/users/jambonsw/events{/privacy}","received_events_url":"https://api.github.com/users/jambonsw/received_events","type":"Organization","site_admin":false},"repo":{"id":118163932,"name":"DefinitelyTyped","full_name":"jambonsw/DefinitelyTyped","owner":{"login":"jambonsw","id":16246134,"avatar_url":"https://avatars0.githubusercontent.com/u/16246134?v=4","gravatar_id":"","url":"https://api.github.com/users/jambonsw","html_url":"https://github.com/jambonsw","followers_url":"https://api.github.com/users/jambonsw/followers","following_url":"https://api.github.com/users/jambonsw/following{/other_user}","gists_url":"https://api.github.com/users/jambonsw/gists{/gist_id}","starred_url":"https://api.github.com/users/jambonsw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jambonsw/subscriptions","organizations_url":"https://api.github.com/users/jambonsw/orgs","repos_url":"https://api.github.com/users/jambonsw/repos","events_url":"https://api.github.com/users/jambonsw/events{/privacy}","received_events_url":"https://api.github.com/users/jambonsw/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jambonsw/DefinitelyTyped","description":"The repository for high quality TypeScript type definitions.","fork":true,"url":"https://api.github.com/repos/jambonsw/DefinitelyTyped","forks_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/forks","keys_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/teams","hooks_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/hooks","issue_events_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/issues/events{/number}","events_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/events","assignees_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/assignees{/user}","branches_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/branches{/branch}","tags_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/tags","blobs_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/git/refs{/sha}","trees_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/statuses/{sha}","languages_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/languages","stargazers_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/stargazers","contributors_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/contributors","subscribers_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/subscribers","subscription_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/subscription","commits_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/commits{/sha}","git_commits_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/git/commits{/sha}","comments_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/comments{/number}","issue_comment_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/issues/comments{/number}","contents_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/contents/{+path}","compare_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/merges","archive_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/downloads","issues_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/issues{/number}","pulls_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/pulls{/number}","milestones_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/milestones{/number}","notifications_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/labels{/name}","releases_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/releases{/id}","deployments_url":"https://api.github.com/repos/jambonsw/DefinitelyTyped/deployments","created_at":"2018-01-19T18:41:15Z","updated_at":"2018-01-19T18:41:39Z","pushed_at":"2018-02-07T19:56:00Z","git_url":"git://github.com/jambonsw/DefinitelyTyped.git","ssh_url":"git@github.com:jambonsw/DefinitelyTyped.git","clone_url":"https://github.com/jambonsw/DefinitelyTyped.git","svn_url":"https://github.com/jambonsw/DefinitelyTyped","homepage":"http://definitelytyped.org/","size":280466,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","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":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"DefinitelyTyped:master","ref":"master","sha":"6a187f6d4476403da23a2a77c3315d3bb573cc1b","user":{"login":"DefinitelyTyped","id":3637556,"avatar_url":"https://avatars1.githubusercontent.com/u/3637556?v=4","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://avatars1.githubusercontent.com/u/3637556?v=4","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":"2018-02-12T17:05:05Z","pushed_at":"2018-02-12T19:01:44Z","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":283160,"stargazers_count":14254,"watchers_count":14254,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11848,"mirror_url":null,"archived":false,"open_issues_count":2040,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":11848,"open_issues":2040,"watchers":14254,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/23268"},"html":{"href":"https://github.com/DefinitelyTyped/DefinitelyTyped/pull/23268"},"issue":{"href":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/23268"},"comments":{"href":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/23268/comments"},"review_comments":{"href":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/23268/comments"},"review_comment":{"href":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/pulls/23268/commits"},"statuses":{"href":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/statuses/84771dc5ce3d4ff50aa9be3df40d3b271c46398c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"atd-schubert"}}