summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKisaragi <48310258+KisaragiEffective@users.noreply.github.com>2024-02-12 11:38:16 +0900
committerGitHub <noreply@github.com>2024-02-12 11:38:16 +0900
commitb95e25004f87cf0743f4a363cd5ed4a7720ad27d (patch)
treeafe0f7769102e95e699b243e5fb4ad43c1dee6d3
parentMerge branch 'develop' of https://github.com/misskey-dev/misskey into develop (diff)
downloadmisskey-b95e25004f87cf0743f4a363cd5ed4a7720ad27d.tar.gz
misskey-b95e25004f87cf0743f4a363cd5ed4a7720ad27d.tar.bz2
misskey-b95e25004f87cf0743f4a363cd5ed4a7720ad27d.zip
refactor(msjs): avoid any (part 1) (#13247)
* refactor(msjs): avoid any * run api extractor --------- Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com>
-rw-r--r--packages/misskey-js/etc/misskey-js.api.md2
-rw-r--r--packages/misskey-js/src/api.ts2
-rw-r--r--packages/misskey-js/src/api.types.ts6
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 3592153f9e..1dba2a70d3 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<PropertyKey, unknown>): 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 2e85fc2939..134ead0d79 100644
--- a/packages/misskey-js/src/api.ts
+++ b/packages/misskey-js/src/api.ts
@@ -17,7 +17,7 @@ export type APIError = {
info: Record<string, any>;
};
-export function isAPIError(reason: any): reason is APIError {
+export function isAPIError(reason: Record<PropertyKey, unknown>): 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 6320081928..af0bade5b3 100644
--- a/packages/misskey-js/src/api.types.ts
+++ b/packages/misskey-js/src/api.types.ts
@@ -15,10 +15,10 @@ type Overwrite<T, U extends { [Key in keyof T]?: unknown }> = Omit<
keyof U
> & U;
-type SwitchCase = {
+type SwitchCase<Condition = unknown, Result = unknown> = {
$switch: {
- $cases: [any, any][],
- $default: any;
+ $cases: [Condition, Result][],
+ $default: Result;
};
};