Select to view content in your preferred language

Issue with rest/geoprocessor typescript 4.20

07-19-2021 11:35 AM
Occasional Contributor


There seems to be at least a typing error in the geoprocessor rest.

When I submit an async geoprocess like below:


const jobSubmitted = await submitJob(url, params);


If I want to fetch I need to use fetchResultData.


fetchResultData(jobId: string, resultName: string, requestOptions?: any, Promise<supportParameterValue>;


Then if I do 


const output = await jobSubmitted.fetchResultData(jobId, resultName);


It returns an error. In the network tab you can see it queries the wrong URL :
It actually uses the jobId twice.
For the moment my workaround is to ignore the typing, and only pass the resultName


const output = await (jobSubmitted as any).fetchResultData(resultName);


Which calls the correct endpoint..
0 Kudos
1 Reply
Frequent Contributor II

Yeah, this was an error in the doc and typings. Your workaround is correct. The doc will be updated in a couple of weeks. If there are enough typings updates, we'll do an update for npm, unsure at the moment.