mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-26 16:57:07 +08:00
removed any
This commit is contained in:
parent
e7c224b007
commit
6d7ee53e63
1 changed files with 7 additions and 6 deletions
|
|
@ -9,12 +9,10 @@ type AxiosClientMethod = (
|
|||
|
||||
type AxiosClientDataMethod = (
|
||||
endpoint: string,
|
||||
data: any,
|
||||
data: unknown,
|
||||
config: AxiosRequestConfig
|
||||
) => Promise<AxiosResponse>;
|
||||
|
||||
type AxiosClientMethods = AxiosClientMethod & AxiosClientDataMethod;
|
||||
|
||||
async function adaptRequestOptions(
|
||||
options: Ape.RequestOptions
|
||||
): Promise<AxiosRequestConfig> {
|
||||
|
|
@ -34,7 +32,7 @@ async function adaptRequestOptions(
|
|||
}
|
||||
|
||||
function apeifyClientMethod(
|
||||
clientMethod: AxiosClientMethods,
|
||||
clientMethod: AxiosClientMethod | AxiosClientDataMethod,
|
||||
methodType: Ape.HttpMethodTypes
|
||||
): Ape.HttpClientMethod {
|
||||
return async (
|
||||
|
|
@ -50,9 +48,12 @@ function apeifyClientMethod(
|
|||
|
||||
let response;
|
||||
if (methodType === "get" || methodType === "delete") {
|
||||
response = await clientMethod(endpoint, requestOptions);
|
||||
response = await (clientMethod as AxiosClientMethod)(
|
||||
endpoint,
|
||||
requestOptions
|
||||
);
|
||||
} else {
|
||||
response = await clientMethod(
|
||||
response = await (clientMethod as AxiosClientDataMethod)(
|
||||
endpoint,
|
||||
requestOptions.data,
|
||||
requestOptions
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue