chore: use AnyFunction from lib everywhere

This commit is contained in:
PalmDevs 2026-07-31 02:32:59 +07:00
parent 10371ff000
commit 1c58b7a5a1
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA
4 changed files with 8 additions and 11 deletions

View file

@ -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
}
/**

View file

@ -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: {

View file

@ -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}`)
}

View file

@ -1,3 +1,5 @@
import type { AnyFunction } from '@revenge-mod/utils/types'
export function debounce<F extends (...args: any[]) => 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