{"action":"created","issue":{"url":"https://api.github.com/repos/Esri/arcgis-rest-js/issues/343","repository_url":"https://api.github.com/repos/Esri/arcgis-rest-js","labels_url":"https://api.github.com/repos/Esri/arcgis-rest-js/issues/343/labels{/name}","comments_url":"https://api.github.com/repos/Esri/arcgis-rest-js/issues/343/comments","events_url":"https://api.github.com/repos/Esri/arcgis-rest-js/issues/343/events","html_url":"https://github.com/Esri/arcgis-rest-js/issues/343","id":365671704,"node_id":"MDU6SXNzdWUzNjU2NzE3MDQ=","number":343,"title":"GeoJSON typing for the feature service package","user":{"login":"itrew","id":12568013,"node_id":"MDQ6VXNlcjEyNTY4MDEz","avatar_url":"https://avatars0.githubusercontent.com/u/12568013?v=4","gravatar_id":"","url":"https://api.github.com/users/itrew","html_url":"https://github.com/itrew","followers_url":"https://api.github.com/users/itrew/followers","following_url":"https://api.github.com/users/itrew/following{/other_user}","gists_url":"https://api.github.com/users/itrew/gists{/gist_id}","starred_url":"https://api.github.com/users/itrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itrew/subscriptions","organizations_url":"https://api.github.com/users/itrew/orgs","repos_url":"https://api.github.com/users/itrew/repos","events_url":"https://api.github.com/users/itrew/events{/privacy}","received_events_url":"https://api.github.com/users/itrew/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-10-01T22:42:26Z","updated_at":"2018-11-09T23:10:51Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Since GeoJSON is a valid output for `FeatureLayer/query` endpoints, I was thinking it may be helpful to add that as an alternative response type for the `getFeature`, `queryFeatures`, and `queryRelated` methods. Maybe a Typescript generic for those three methods?\r\n\r\nThe reason I bring this up is that I am working on a library that needs to grab data from a service before processing it. The utility I will be using for processing desires GeoJSON, so my goal was to just overwrite the request options with the output format of 'geojson'.  Right now, I have to assert the response to the GeoJSON type as follows. \r\n\r\n```\r\nimport * as fetch from 'isomorphic-fetch'\r\nimport * as FormData from 'form-data'\r\nimport { queryFeatures, IQueryFeaturesRequestOptions } from '@esri/arcgis-rest-feature-service'\r\n\r\nexport async function fetchESRIGeoJSON(\r\n  options: IQueryFeaturesRequestOptions\r\n): Promise<GeoJSON.GeoJSON> {\r\n  // Overwrite the output format parameter.\r\n  options.params = {\r\n    ...options.params,\r\n    ...{ f: \"geojson\" }\r\n  }\r\n  // Requires the assertion of the queryFeatures response as a GeoJSON.\r\n  const features: GeoJSON.GeoJSON = await queryFeatures(options) as GeoJSON.GeoJSON\r\n  return features\r\n}\r\n```\r\n\r\nIt works fine for now, but just a thought for the future."},"comment":{"url":"https://api.github.com/repos/Esri/arcgis-rest-js/issues/comments/437524321","html_url":"https://github.com/Esri/arcgis-rest-js/issues/343#issuecomment-437524321","issue_url":"https://api.github.com/repos/Esri/arcgis-rest-js/issues/343","id":437524321,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzUyNDMyMQ==","user":{"login":"itrew","id":12568013,"node_id":"MDQ6VXNlcjEyNTY4MDEz","avatar_url":"https://avatars0.githubusercontent.com/u/12568013?v=4","gravatar_id":"","url":"https://api.github.com/users/itrew","html_url":"https://github.com/itrew","followers_url":"https://api.github.com/users/itrew/followers","following_url":"https://api.github.com/users/itrew/following{/other_user}","gists_url":"https://api.github.com/users/itrew/gists{/gist_id}","starred_url":"https://api.github.com/users/itrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itrew/subscriptions","organizations_url":"https://api.github.com/users/itrew/orgs","repos_url":"https://api.github.com/users/itrew/repos","events_url":"https://api.github.com/users/itrew/events{/privacy}","received_events_url":"https://api.github.com/users/itrew/received_events","type":"User","site_admin":false},"created_at":"2018-11-09T23:10:51Z","updated_at":"2018-11-09T23:10:51Z","author_association":"CONTRIBUTOR","body":"Personally I am in favor of using overloads in scenarios like this. To me would be nicer to let the function (queryFeature, queryFeatures, etc.) determine the response type based on the input rather than worry about asserting the output. Since this is a TS library, it would be nice to be able to provide TS features where possible.\r\n\r\nI'd be happy to take another crack at it after I closed #346."}}
{"actor":{"display_login":"itrew"}}