diff --git a/lib/discord/src/types/index.ts b/lib/discord/src/types/index.ts index 7778c73..49c8c7e 100644 --- a/lib/discord/src/types/index.ts +++ b/lib/discord/src/types/index.ts @@ -1,5 +1,6 @@ import type { StackScreenProps } from '@react-navigation/stack' import type { ReactNavigationParamList } from '@revenge-mod/externals/react-navigation' +import type { AnyFunction } from '@revenge-mod/utils/types' import type { ComponentProps, ComponentType, @@ -128,13 +129,7 @@ export namespace DiscordModules { } export interface Constants { - [K: string]: - | string - | number - | boolean - | null - | ((...args: any[]) => any) - | Constants + [K: string]: string | number | boolean | null | AnyFunction | Constants } /** diff --git a/lib/modules/src/native/index.ts b/lib/modules/src/native/index.ts index 0a98a80..3289d43 100644 --- a/lib/modules/src/native/index.ts +++ b/lib/modules/src/native/index.ts @@ -1,4 +1,5 @@ import { getCurrentStack, getErrorStack } from '@revenge-mod/utils/error' +import type { AnyFunction } from '@revenge-mod/utils/types' const turboModuleProxy = globalThis.__turboModuleProxy @@ -105,8 +106,6 @@ export function getBridgeInfo(): BridgeInfo | null { } } -type AnyFunction = (...args: any[]) => any - const CallableReturnNativeMethodName = 'revenge.__callableReturn' as const const CallableModuleName = 'RevengeBridge' const ExposedJSMethods: { diff --git a/lib/plugins/src/_internal/external-plugins.ts b/lib/plugins/src/_internal/external-plugins.ts index 4f5e68e..6f53b1c 100644 --- a/lib/plugins/src/_internal/external-plugins.ts +++ b/lib/plugins/src/_internal/external-plugins.ts @@ -21,6 +21,7 @@ import { } from '.' import { pPending } from './dependency-graph' import { registerRepositoryEvents } from './repositories' +import type { AnyFunction } from '@revenge-mod/utils/types' import type { PluginLifecycles, PluginManifest, @@ -229,7 +230,7 @@ export function confirmInstall( function assertIsFunction( name: string, value: unknown, -): asserts value is (...args: any[]) => any { +): asserts value is AnyFunction { if (typeof value !== 'function') throw new Error(`${name} must be a function, got ${typeof value}`) } diff --git a/lib/utils/src/callback.ts b/lib/utils/src/callback.ts index cf50fe7..a99deae 100644 --- a/lib/utils/src/callback.ts +++ b/lib/utils/src/callback.ts @@ -1,3 +1,5 @@ +import type { AnyFunction } from '@revenge-mod/utils/types' + export function debounce any>( func: F, timeout: number, @@ -20,7 +22,7 @@ const now = (cb: () => any) => { * A function that runs the callback as soon as possible. * @param cb The callback to run. */ -export const asap = (cb: (...args: any[]) => any) => { +export const asap = (cb: AnyFunction) => { // @ts-expect-error ;(HermesInternal.useEngineQueue() ? // @ts-expect-error