Skip to content

Commit

Permalink
refactor(msjs): avoid any (part 1) (misskey-dev#13247)
Browse files Browse the repository at this point in the history
* refactor(msjs): avoid any

* run api extractor

---------

Co-authored-by: かっこかり <[email protected]>
Co-authored-by: kakkokari-gtyih <[email protected]>
  • Loading branch information
3 people authored and AyumuNekozuki committed Feb 16, 2024
1 parent 7cbcbdb commit de78a4f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/misskey-js/etc/misskey-js.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
2 changes: 1 addition & 1 deletion packages/misskey-js/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions packages/misskey-js/src/api.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};

Expand Down

0 comments on commit de78a4f

Please sign in to comment.