diff --git a/src/Utils.ts b/src/Utils.ts index 503c7ed7d..141bdaa0e 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -1011,11 +1011,11 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be }) } - public static async downloadJsonCached( + public static async downloadJsonCached( url: string, maxCacheTimeMs: number, headers?: Record - ): Promise { + ): Promise { const result = await Utils.downloadJsonCachedAdvanced(url, maxCacheTimeMs, headers) if (result["content"]) { return result["content"] @@ -1023,11 +1023,11 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be throw result["error"] } - public static async downloadJsonCachedAdvanced( + public static async downloadJsonCachedAdvanced( url: string, maxCacheTimeMs: number, headers?: Record - ): Promise<{ content: object | [] } | { error: string; url: string; statuscode?: number }> { + ): Promise<{ content: T } | { error: string; url: string; statuscode?: number }> { const cached = Utils._download_cache.get(url) if (cached !== undefined) { if (new Date().getTime() - cached.timestamp <= maxCacheTimeMs) { @@ -1042,10 +1042,10 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be Utils._download_cache.set(url, { promise, timestamp: new Date().getTime() }) return await promise } - public static async downloadJson( + public static async downloadJson( url: string, headers?: Record - ): Promise + ): Promise public static async downloadJson( url: string, headers?: Record