[Metro > Common] Tidy and type
This commit is contained in:
parent
4551b3d553
commit
c494caf421
2 changed files with 22 additions and 13 deletions
33
src/def.d.ts
vendored
33
src/def.d.ts
vendored
|
@ -1,4 +1,7 @@
|
||||||
import * as _spitroast from "spitroast";
|
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 };
|
type MetroModules = { [id: number]: any };
|
||||||
|
|
||||||
|
@ -9,13 +12,13 @@ type PropsFinderAll = <T extends string | symbol>(...props: T[]) => PropIntellis
|
||||||
|
|
||||||
type LoggerFunction = (...messages: any[]) => void;
|
type LoggerFunction = (...messages: any[]) => void;
|
||||||
interface Logger {
|
interface Logger {
|
||||||
log: LoggerFunction,
|
log: LoggerFunction;
|
||||||
info: LoggerFunction,
|
info: LoggerFunction;
|
||||||
warn: LoggerFunction,
|
warn: LoggerFunction;
|
||||||
error: LoggerFunction,
|
error: LoggerFunction;
|
||||||
time: LoggerFunction,
|
time: LoggerFunction;
|
||||||
trace: LoggerFunction,
|
trace: LoggerFunction;
|
||||||
verbose: LoggerFunction,
|
verbose: LoggerFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
type SearchFilter = (tree: any) => boolean;
|
type SearchFilter = (tree: any) => boolean;
|
||||||
|
@ -31,15 +34,21 @@ interface VendettaObject {
|
||||||
before: typeof _spitroast.before;
|
before: typeof _spitroast.before;
|
||||||
instead: typeof _spitroast.instead;
|
instead: typeof _spitroast.instead;
|
||||||
unpatchAll: typeof _spitroast.unpatchAll;
|
unpatchAll: typeof _spitroast.unpatchAll;
|
||||||
}
|
};
|
||||||
metro: {
|
metro: {
|
||||||
findByProps: PropsFinder;
|
findByProps: PropsFinder;
|
||||||
findByPropsAll: PropsFinderAll;
|
findByPropsAll: PropsFinderAll;
|
||||||
findByDisplayName: (name: string, defaultExp: boolean) => any;
|
findByDisplayName: (name: string, defaultExp: boolean) => any;
|
||||||
findByDisplayNameAll: (name: string, defaultExp: boolean) => any[];
|
findByDisplayNameAll: (name: string, defaultExp: boolean) => any[];
|
||||||
// TODO: Proper typing for common modules
|
common: {
|
||||||
common: Object;
|
constants: Object;
|
||||||
}
|
channels: Object;
|
||||||
|
i18n: Object;
|
||||||
|
React: typeof _React;
|
||||||
|
ReactNative: typeof _RN;
|
||||||
|
AsyncStorage: typeof _AsyncStorage;
|
||||||
|
};
|
||||||
|
};
|
||||||
logger: Logger;
|
logger: Logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,4 +58,4 @@ declare global {
|
||||||
modules: MetroModules;
|
modules: MetroModules;
|
||||||
vendetta: VendettaObject;
|
vendetta: VendettaObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { findByProps } from "@metro/filters";
|
import { findByProps } from "@metro/filters";
|
||||||
|
|
||||||
// Discord
|
// Discord
|
||||||
export const Constants = findByProps("API_HOST");
|
export const constants = findByProps("API_HOST");
|
||||||
export const channels = findByProps("getVoiceChannelId");
|
export const channels = findByProps("getVoiceChannelId");
|
||||||
export const i18n = findByProps("Messages");
|
export const i18n = findByProps("Messages");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue