-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
My response to this forum question contains additional context.
Type contradiction:
export type TMulticall = <T = any>(calls: TCallParams[]) => Promise<T[]>;
callXHR method non-error return value (which is used in each geoApi call method):
return { abort: function () { xhr.abort(); } }
Conclusion:
The type should either be corrected to show the developer the usage of success and error callbacks, or the development api should be updated to return the specified promise.
Current workaround (ts-ignore required to not error out due to type contradiction):
// Success callback
// @ts-ignore
geoApi.multiCall<any>(calls, (results) => console.debug("success callback results: ", results), (error) => console.error(error));
// Async Await (needs additional error handling, if rej gets called and awaited it will throw an error)
// @ts-ignore
const results = await new Promise((res, rej) => geoApi.multiCall<any>(calls, (results) => res(results), (error) => rej(error)));
console.debug("async await results: ", results);
Metadata
Metadata
Assignees
Labels
No labels