diff --git a/src/def.d.ts b/src/def.d.ts index f8bff52..3c59945 100644 --- a/src/def.d.ts +++ b/src/def.d.ts @@ -124,8 +124,8 @@ interface ThemeData { description?: string; authors?: Author[]; spec: number; - semanticColors?: Indexable; - rawColors?: Indexable; + semanticColors?: Record; + rawColors?: Record; } interface Theme { @@ -292,8 +292,6 @@ interface FileManager { DocumentsDirPath: string; } -type Indexable = { [index: string]: Type } - type EmitterEvent = "SET" | "GET" | "DEL"; interface EmitterListenerData { @@ -306,7 +304,7 @@ type EmitterListener = ( data: EmitterListenerData | any ) => any; -type EmitterListeners = Indexable>; +type EmitterListeners = Record> interface Emitter { listeners: EmitterListeners; @@ -437,18 +435,18 @@ interface VendettaObject { showInputAlert: (options: InputAlertProps) => void; }; assets: { - all: Indexable; + all: Record; find: (filter: (a: any) => void) => Asset | null | undefined; getAssetByName: (name: string) => Asset; getAssetByID: (id: number) => Asset; getAssetIDByName: (name: string) => number; }; // TODO: Make a vain attempt to type these - semanticColors: Indexable; - rawColors: Indexable; + semanticColors: Record; + rawColors: Record; }; plugins: { - plugins: Indexable; + plugins: Record; fetchPlugin: (id: string) => Promise; installPlugin: (id: string, enabled?: boolean) => Promise; startPlugin: (id: string) => Promise; @@ -457,7 +455,7 @@ interface VendettaObject { getSettings: (id: string) => JSX.Element; }; themes: { - themes: Indexable; + themes: Record; fetchTheme: (id: string, selected?: boolean) => Promise; installTheme: (id: string) => Promise; selectTheme: (id: string) => Promise; @@ -490,7 +488,7 @@ interface VendettaObject { interface VendettaPluginObject { id: string; manifest: PluginManifest; - storage: Indexable; + storage: Record; } declare global { diff --git a/src/lib/plugins.ts b/src/lib/plugins.ts index 04edce7..5075981 100644 --- a/src/lib/plugins.ts +++ b/src/lib/plugins.ts @@ -1,4 +1,4 @@ -import { Indexable, PluginManifest, Plugin } from "@types"; +import { PluginManifest, Plugin } from "@types"; import { awaitSyncWrapper, createMMKVBackend, createStorage, wrapSync } from "@lib/storage"; import { MMKVManager } from "@lib/native"; import settings from "@lib/settings"; @@ -11,8 +11,8 @@ type EvaledPlugin = { settings: JSX.Element; }; -export const plugins = wrapSync(createStorage>(createMMKVBackend("VENDETTA_PLUGINS"))); -const loadedPlugins: Indexable = {}; +export const plugins = wrapSync(createStorage>(createMMKVBackend("VENDETTA_PLUGINS"))); +const loadedPlugins: Record = {}; export async function fetchPlugin(id: string) { if (!id.endsWith("/")) id += "/"; @@ -60,7 +60,7 @@ export async function evalPlugin(plugin: Plugin) { id: plugin.id, manifest: plugin.manifest, // Wrapping this with wrapSync is NOT an option. - storage: await createStorage>(createMMKVBackend(plugin.id)), + storage: await createStorage>(createMMKVBackend(plugin.id)), }, logger: new logModule(`Vendetta ยป ${plugin.manifest.name}`), }; diff --git a/src/lib/themes.ts b/src/lib/themes.ts index 8e3b2e3..3497a2e 100644 --- a/src/lib/themes.ts +++ b/src/lib/themes.ts @@ -1,4 +1,4 @@ -import { Indexable, Theme, ThemeData } from "@types"; +import { Theme, ThemeData } from "@types"; import { findByProps } from "@metro/filters"; import { ReactNative, chroma } from "@metro/common"; import { instead } from "@lib/patcher"; @@ -9,7 +9,7 @@ import { safeFetch } from "@utils"; // Somehow, this is late enough, though? export const color = findByProps("SemanticColor"); -export const themes = wrapSync(createStorage>(createMMKVBackend("VENDETTA_THEMES"))); +export const themes = wrapSync(createStorage>(createMMKVBackend("VENDETTA_THEMES"))); async function writeTheme(theme: Theme | {}) { if (typeof theme !== "object") throw new Error("Theme must be an object"); diff --git a/src/ui/assets.ts b/src/ui/assets.ts index 8527735..842abe9 100644 --- a/src/ui/assets.ts +++ b/src/ui/assets.ts @@ -1,8 +1,8 @@ -import { Asset, Indexable } from "@types"; +import { Asset } from "@types"; import { assets } from "@metro/common"; import { after } from "@lib/patcher"; -export const all: Indexable = {}; +export const all: Record = {}; export function patchAssets() { const unpatch = after("registerAsset", assets, (args: Asset[], id: number) => { diff --git a/src/ui/settings/components/AddonPage.tsx b/src/ui/settings/components/AddonPage.tsx index eb5e30a..cbcce8e 100644 --- a/src/ui/settings/components/AddonPage.tsx +++ b/src/ui/settings/components/AddonPage.tsx @@ -1,4 +1,3 @@ -import { Indexable } from "@types"; import { ReactNative as RN } from "@metro/common"; import { useProxy } from "@lib/storage"; import { HelpMessage, ErrorBoundary, Search } from "@ui/components"; @@ -6,7 +5,7 @@ import { CardWrapper } from "@ui/settings/components/Card"; import settings from "@lib/settings"; interface AddonPageProps { - items: Indexable; + items: Record; safeModeMessage: string; safeModeExtras?: JSX.Element | JSX.Element[]; card: React.ComponentType>;