refactor: fix type

This commit is contained in:
syuilo 2023-02-01 20:13:22 +09:00
parent d9d98f84bf
commit fa296efdf6

View file

@ -95,7 +95,7 @@ export class HttpRequestService {
} }
@bindThis @bindThis
public async getJson(url: string, accept = 'application/json, */*', headers?: Record<string, string>): Promise<unknown> { public async getJson<T = unknown>(url: string, accept = 'application/json, */*', headers?: Record<string, string>): Promise<T> {
const res = await this.send(url, { const res = await this.send(url, {
method: 'GET', method: 'GET',
headers: Object.assign({ headers: Object.assign({
@ -106,7 +106,7 @@ export class HttpRequestService {
size: 1024 * 256, size: 1024 * 256,
}); });
return await res.json(); return await res.json() as T;
} }
@bindThis @bindThis