2022-10-18 22:04:55 +00:00
|
|
|
import * as _spitroast from "spitroast";
|
2022-10-22 17:59:01 +00:00
|
|
|
import _React from "react";
|
|
|
|
import _RN from "react-native";
|
|
|
|
import _AsyncStorage from "@react-native-async-storage/async-storage";
|
2022-10-18 22:04:55 +00:00
|
|
|
|
|
|
|
type MetroModules = { [id: number]: any };
|
|
|
|
|
|
|
|
// Helper types for API functions
|
|
|
|
type PropIntellisense<P extends string | symbol> = Record<P, any> & Record<PropertyKey, any>;
|
|
|
|
type PropsFinder = <T extends string | symbol>(...props: T[]) => PropIntellisense<T>;
|
|
|
|
type PropsFinderAll = <T extends string | symbol>(...props: T[]) => PropIntellisense<T>[];
|
|
|
|
|
|
|
|
type LoggerFunction = (...messages: any[]) => void;
|
|
|
|
interface Logger {
|
2022-10-22 17:59:01 +00:00
|
|
|
log: LoggerFunction;
|
|
|
|
info: LoggerFunction;
|
|
|
|
warn: LoggerFunction;
|
|
|
|
error: LoggerFunction;
|
|
|
|
time: LoggerFunction;
|
|
|
|
trace: LoggerFunction;
|
|
|
|
verbose: LoggerFunction;
|
2022-10-18 22:04:55 +00:00
|
|
|
}
|
|
|
|
|
2022-10-18 22:21:58 +00:00
|
|
|
type SearchFilter = (tree: any) => boolean;
|
|
|
|
interface FindInTreeOptions {
|
|
|
|
walkable?: string[];
|
|
|
|
ignore?: string[];
|
|
|
|
maxDepth?: number;
|
|
|
|
}
|
|
|
|
|
2022-10-22 22:26:06 +00:00
|
|
|
interface Asset {
|
|
|
|
name: string;
|
|
|
|
id: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Assets {
|
|
|
|
[id: string]: Asset;
|
|
|
|
}
|
|
|
|
|
2022-10-18 22:04:55 +00:00
|
|
|
interface VendettaObject {
|
|
|
|
patcher: {
|
|
|
|
after: typeof _spitroast.after;
|
|
|
|
before: typeof _spitroast.before;
|
|
|
|
instead: typeof _spitroast.instead;
|
|
|
|
unpatchAll: typeof _spitroast.unpatchAll;
|
2022-10-22 17:59:01 +00:00
|
|
|
};
|
2022-10-18 22:04:55 +00:00
|
|
|
metro: {
|
|
|
|
findByProps: PropsFinder;
|
|
|
|
findByPropsAll: PropsFinderAll;
|
|
|
|
findByDisplayName: (name: string, defaultExp: boolean) => any;
|
|
|
|
findByDisplayNameAll: (name: string, defaultExp: boolean) => any[];
|
2022-10-22 17:59:01 +00:00
|
|
|
common: {
|
|
|
|
constants: Object;
|
|
|
|
channels: Object;
|
|
|
|
i18n: Object;
|
|
|
|
React: typeof _React;
|
|
|
|
ReactNative: typeof _RN;
|
|
|
|
AsyncStorage: typeof _AsyncStorage;
|
|
|
|
};
|
|
|
|
};
|
2022-10-22 22:26:06 +00:00
|
|
|
ui: {
|
|
|
|
assets: {
|
|
|
|
all: Assets;
|
|
|
|
find: (filter: (a: any) => void) => Asset | null | undefined;
|
|
|
|
getAssetByName: (name: string) => Asset;
|
2022-10-22 23:05:04 +00:00
|
|
|
getAssetByID: (id: number) => Asset;
|
2022-10-22 22:26:06 +00:00
|
|
|
getAssetIDByName: (name: string) => number;
|
|
|
|
}
|
|
|
|
};
|
2022-10-18 22:04:55 +00:00
|
|
|
logger: Logger;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare global {
|
|
|
|
interface Window {
|
|
|
|
[key: PropertyKey]: any;
|
|
|
|
modules: MetroModules;
|
|
|
|
vendetta: VendettaObject;
|
|
|
|
}
|
2022-10-22 17:59:01 +00:00
|
|
|
}
|