From b95e25004f87cf0743f4a363cd5ed4a7720ad27d Mon Sep 17 00:00:00 2001 From: Kisaragi <48310258+KisaragiEffective@users.noreply.github.com> Date: Mon, 12 Feb 2024 11:38:16 +0900 Subject: [PATCH] refactor(msjs): avoid any (part 1) (#13247) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(msjs): avoid any * run api extractor --------- Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: kakkokari-gtyih --- packages/misskey-js/etc/misskey-js.api.md | 2 +- packages/misskey-js/src/api.ts | 2 +- packages/misskey-js/src/api.types.ts | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/misskey-js/etc/misskey-js.api.md b/packages/misskey-js/etc/misskey-js.api.md index 3592153f9..1dba2a70d 100644 --- a/packages/misskey-js/etc/misskey-js.api.md +++ b/packages/misskey-js/etc/misskey-js.api.md @@ -2165,7 +2165,7 @@ type IResponse = operations['i']['responses']['200']['content']['application/jso type IRevokeTokenRequest = operations['i/revoke-token']['requestBody']['content']['application/json']; // @public (undocumented) -function isAPIError(reason: any): reason is APIError; +function isAPIError(reason: Record): reason is APIError; // @public (undocumented) type ISigninHistoryRequest = operations['i/signin-history']['requestBody']['content']['application/json']; diff --git a/packages/misskey-js/src/api.ts b/packages/misskey-js/src/api.ts index 2e85fc293..134ead0d7 100644 --- a/packages/misskey-js/src/api.ts +++ b/packages/misskey-js/src/api.ts @@ -17,7 +17,7 @@ export type APIError = { info: Record; }; -export function isAPIError(reason: any): reason is APIError { +export function isAPIError(reason: Record): reason is APIError { return reason[MK_API_ERROR] === true; } diff --git a/packages/misskey-js/src/api.types.ts b/packages/misskey-js/src/api.types.ts index 632008192..af0bade5b 100644 --- a/packages/misskey-js/src/api.types.ts +++ b/packages/misskey-js/src/api.types.ts @@ -15,10 +15,10 @@ type Overwrite = Omit< keyof U > & U; -type SwitchCase = { +type SwitchCase = { $switch: { - $cases: [any, any][], - $default: any; + $cases: [Condition, Result][], + $default: Result; }; };