From cfdee54d8eb2ac136ddea4d444af365471196154 Mon Sep 17 00:00:00 2001 From: Beef Date: Thu, 6 Apr 2023 00:08:48 +0100 Subject: [PATCH] [TS] Fix alerts API types --- src/def.d.ts | 22 ++++++++++---------- src/ui/settings/components/InstallButton.tsx | 1 - src/ui/settings/components/ThemeCard.tsx | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/def.d.ts b/src/def.d.ts index d94d594..3c5fe35 100644 --- a/src/def.d.ts +++ b/src/def.d.ts @@ -63,22 +63,22 @@ export enum ButtonColors { } interface ConfirmationAlertOptions { - title: string | undefined; + title?: string; content: string | JSX.Element | JSX.Element[]; - confirmText: string | undefined; - confirmColor: ButtonColors | undefined; + confirmText?: string; + confirmColor?: ButtonColors; onConfirm: () => void; - cancelText: string | undefined; + cancelText?: string; } interface InputAlertProps { - title: string | undefined; - confirmText: string | undefined; - confirmColor: ButtonColors | undefined; - onConfirm: (input: string) => void | Promise; - cancelText: string | undefined; - placeholder: string | undefined; - initialValue: string | undefined; + title?: string; + confirmText?: string; + confirmColor?: ButtonColors; + onConfirm: (input: string) => (void | Promise); + cancelText?: string; + placeholder?: string; + initialValue?: string; } interface Author { diff --git a/src/ui/settings/components/InstallButton.tsx b/src/ui/settings/components/InstallButton.tsx index 3cadc73..02f2f08 100644 --- a/src/ui/settings/components/InstallButton.tsx +++ b/src/ui/settings/components/InstallButton.tsx @@ -26,7 +26,6 @@ export default function InstallButton({ alertTitle, installFunction: fetchFuncti placeholder: "https://example.com/", onConfirm: (input: string) => fetchFunction(input), confirmText: "Install", - confirmColor: undefined, cancelText: "Cancel" }) ) diff --git a/src/ui/settings/components/ThemeCard.tsx b/src/ui/settings/components/ThemeCard.tsx index f6c1111..2368747 100644 --- a/src/ui/settings/components/ThemeCard.tsx +++ b/src/ui/settings/components/ThemeCard.tsx @@ -1,5 +1,5 @@ import { ButtonColors, Theme } from "@types"; -import { ReactNative as RN, clipboard } from "@metro/common"; +import { clipboard } from "@metro/common"; import { fetchTheme, removeTheme, selectTheme } from "@lib/themes"; import { BundleUpdaterManager } from "@lib/native"; import { getAssetIDByName } from "@ui/assets";