From 1cdf9e19a09d091607d46427e606c3e169659c42 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 1 Jun 2021 14:17:05 +0900 Subject: [PATCH] fix type --- src/api.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api.ts b/src/api.ts index 8961fb7ba..d97db087b 100644 --- a/src/api.ts +++ b/src/api.ts @@ -44,14 +44,14 @@ export class APIClient { } public request( - endpoint: E, params: P, credential?: string | null | undefined, + endpoint: E, params: P = {} as P, credential?: string | null | undefined, ): Promise> extends true ? Endpoints[E]['res']['$switch']['$default'] : StrictExtract[1] : Endpoints[E]['res']> { - const promise = new Promise((resolve, reject) => { + const promise = new Promise((resolve, reject) => { this.fetch(`${this.origin}/api/${endpoint}`, { method: 'POST', body: JSON.stringify({ @@ -76,6 +76,6 @@ export class APIClient { }).catch(reject); }); - return promise; + return promise as any; } }