diff --git a/src/def.d.ts b/src/def.d.ts index 3c39e00..1b0dbc9 100644 --- a/src/def.d.ts +++ b/src/def.d.ts @@ -1,4 +1,7 @@ import * as _spitroast from "spitroast"; +import _React from "react"; +import _RN from "react-native"; +import _AsyncStorage from "@react-native-async-storage/async-storage"; type MetroModules = { [id: number]: any }; @@ -9,13 +12,13 @@ type PropsFinderAll = (...props: T[]) => PropIntellis type LoggerFunction = (...messages: any[]) => void; interface Logger { - log: LoggerFunction, - info: LoggerFunction, - warn: LoggerFunction, - error: LoggerFunction, - time: LoggerFunction, - trace: LoggerFunction, - verbose: LoggerFunction, + log: LoggerFunction; + info: LoggerFunction; + warn: LoggerFunction; + error: LoggerFunction; + time: LoggerFunction; + trace: LoggerFunction; + verbose: LoggerFunction; } type SearchFilter = (tree: any) => boolean; @@ -31,15 +34,21 @@ interface VendettaObject { before: typeof _spitroast.before; instead: typeof _spitroast.instead; unpatchAll: typeof _spitroast.unpatchAll; - } + }; metro: { findByProps: PropsFinder; findByPropsAll: PropsFinderAll; findByDisplayName: (name: string, defaultExp: boolean) => any; findByDisplayNameAll: (name: string, defaultExp: boolean) => any[]; - // TODO: Proper typing for common modules - common: Object; - } + common: { + constants: Object; + channels: Object; + i18n: Object; + React: typeof _React; + ReactNative: typeof _RN; + AsyncStorage: typeof _AsyncStorage; + }; + }; logger: Logger; } @@ -49,4 +58,4 @@ declare global { modules: MetroModules; vendetta: VendettaObject; } -} \ No newline at end of file +} diff --git a/src/lib/metro/common.ts b/src/lib/metro/common.ts index 7fa3e17..2b9c3ec 100644 --- a/src/lib/metro/common.ts +++ b/src/lib/metro/common.ts @@ -1,7 +1,7 @@ import { findByProps } from "@metro/filters"; // Discord -export const Constants = findByProps("API_HOST"); +export const constants = findByProps("API_HOST"); export const channels = findByProps("getVoiceChannelId"); export const i18n = findByProps("Messages");