[TS] Typing for createThemedStylesheet

This commit is contained in:
Beef 2023-04-04 19:33:31 +01:00
parent b7a3580ccf
commit 81fbf02ad9
2 changed files with 8 additions and 2 deletions

7
src/def.d.ts vendored
View file

@ -326,6 +326,11 @@ interface LoaderIdentity {
} }
} }
interface DiscordStyleSheet {
[index: string]: any,
createThemedStyleSheet: typeof _RN.StyleSheet.create;
}
interface VendettaObject { interface VendettaObject {
patcher: { patcher: {
after: typeof _spitroast.after; after: typeof _spitroast.after;
@ -348,7 +353,7 @@ interface VendettaObject {
i18n: PropIntellisense<"Messages">; i18n: PropIntellisense<"Messages">;
url: PropIntellisense<"openURL">; url: PropIntellisense<"openURL">;
toasts: PropIntellisense<"open" | "close">; toasts: PropIntellisense<"open" | "close">;
stylesheet: PropIntellisense<"createThemedStyleSheet">; stylesheet: DiscordStyleSheet;
clipboard: typeof _Clipboard; clipboard: typeof _Clipboard;
assets: PropIntellisense<"registerAsset">; assets: PropIntellisense<"registerAsset">;
invites: PropIntellisense<"acceptInviteAndTransitionToInviteChannel">; invites: PropIntellisense<"acceptInviteAndTransitionToInviteChannel">;

View file

@ -1,3 +1,4 @@
import { DiscordStyleSheet } from "@types";
import { find, findByProps } from "@metro/filters"; import { find, findByProps } from "@metro/filters";
// Discord // Discord
@ -6,7 +7,7 @@ export const channels = findByProps("getVoiceChannelId");
export const i18n = findByProps("Messages"); export const i18n = findByProps("Messages");
export const url = findByProps("openURL", "openDeeplink"); export const url = findByProps("openURL", "openDeeplink");
export const toasts = find(m => m.open && m.close && !m.startDrag && !m.init && !m.openReplay && !m.setAlwaysOnTop); export const toasts = find(m => m.open && m.close && !m.startDrag && !m.init && !m.openReplay && !m.setAlwaysOnTop);
export const stylesheet = findByProps("createThemedStyleSheet"); export const stylesheet = findByProps("createThemedStyleSheet") as DiscordStyleSheet;
export const clipboard = findByProps("setString", "getString", "hasString") as typeof import("@react-native-clipboard/clipboard").default; export const clipboard = findByProps("setString", "getString", "hasString") as typeof import("@react-native-clipboard/clipboard").default;
export const assets = findByProps("registerAsset"); export const assets = findByProps("registerAsset");
export const invites = findByProps("acceptInviteAndTransitionToInviteChannel"); export const invites = findByProps("acceptInviteAndTransitionToInviteChannel");