From a893501154978043df35ad923b686d65de51cd3e Mon Sep 17 00:00:00 2001 From: Myzel394 <50424412+Myzel394@users.noreply.github.com> Date: Sat, 18 Feb 2023 19:39:33 +0100 Subject: [PATCH] fix: tsc fixes --- package.json | 2 +- src/components/AuthContext/use-master-password.ts | 2 +- src/components/widgets/AliasTypeIndicator.tsx | 1 + src/hooks/use-extension-handler.ts | 2 +- .../LoginRoute/ConfirmCodeForm/ResendMailButton.tsx | 6 +++--- .../ReservedAliasDetailRoute/AliasUsersList.tsx | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 8d6e10d..654d548 100755 --- a/package.json +++ b/package.json @@ -60,13 +60,13 @@ "@types/lodash": "^4.14.191", "@types/node": "^18.11.18", "@types/openpgp": "^4.4.18", + "@types/react-dom": "^18.0.11", "@types/react-icons": "^3.0.0", "@types/react-router": "^5.1.19", "@types/react-router-dom": "^5.3.3", "@types/secure-random-password": "^0.2.1", "@types/sort-array": "^4.1.0", "@types/ua-parser-js": "^0.7.36", - "@types/yup": "^0.32.0", "@typescript-eslint/eslint-plugin": "^5.40.0", "@typescript-eslint/parser": "^5.40.0", "@vitejs/plugin-react": "^2.1.0", diff --git a/src/components/AuthContext/use-master-password.ts b/src/components/AuthContext/use-master-password.ts index 8585585..d8f1c72 100644 --- a/src/components/AuthContext/use-master-password.ts +++ b/src/components/AuthContext/use-master-password.ts @@ -79,7 +79,7 @@ export default function useMasterPassword(user: User | ServerUser | null): UseMa decryptUsingMasterPassword, decryptUsingPrivateKey, logout, - setEncryptionPassword, + setEncryptionPassword: setEncryptionPassword as Dispatch>, _encryptionPassword: encryptionPassword!, decryptionPasswordHash: fastHashCode(encryptionPassword || "").toString(), } diff --git a/src/components/widgets/AliasTypeIndicator.tsx b/src/components/widgets/AliasTypeIndicator.tsx index ebcd0a6..4e7028e 100644 --- a/src/components/widgets/AliasTypeIndicator.tsx +++ b/src/components/widgets/AliasTypeIndicator.tsx @@ -25,6 +25,7 @@ export default function AliasTypeIndicator({type}: AliasTypeIndicatorProps): Rea const {t} = useTranslation() return ( + // @ts-ignore {ALIAS_TYPE_ICON_MAP[type]} diff --git a/src/hooks/use-extension-handler.ts b/src/hooks/use-extension-handler.ts index 3d07239..b99731a 100644 --- a/src/hooks/use-extension-handler.ts +++ b/src/hooks/use-extension-handler.ts @@ -6,7 +6,7 @@ import {ExtensionKleckEvent, ExtensionKleckMessageLatestAlias} from "~/extension export interface UseExtensionHandlerData { onEnterPassword?: () => void onRefetchAliases?: () => void - onLatestAliasChange?: ({latestAliasId}: ExtensionKleckMessageLatestAlias["data"]) => void + onLatestAliasChange?: ({latestAlias}: ExtensionKleckMessageLatestAlias["data"]) => void } export default function useExtensionHandler({ diff --git a/src/route-widgets/LoginRoute/ConfirmCodeForm/ResendMailButton.tsx b/src/route-widgets/LoginRoute/ConfirmCodeForm/ResendMailButton.tsx index 06e3c13..3d52a46 100644 --- a/src/route-widgets/LoginRoute/ConfirmCodeForm/ResendMailButton.tsx +++ b/src/route-widgets/LoginRoute/ConfirmCodeForm/ResendMailButton.tsx @@ -6,9 +6,9 @@ import React, {ReactElement} from "react" import {useMutation} from "@tanstack/react-query" -import {ResendEmailLoginCodeResponse, resendEmailLoginCode} from "~/apis" +import {resendEmailLoginCode} from "~/apis" import {MutationStatusSnackbar, TimedButton} from "~/components" -import {ServerSettings} from "~/server-types" +import {ServerSettings, SimpleDetailResponse} from "~/server-types" export interface ResendMailButtonProps { email: string @@ -22,7 +22,7 @@ export default function ResendMailButton({ const settings = useLoaderData() as ServerSettings const {t} = useTranslation() - const mutation = useMutation(() => + const mutation = useMutation(() => resendEmailLoginCode({ email, sameRequestToken, diff --git a/src/route-widgets/ReservedAliasDetailRoute/AliasUsersList.tsx b/src/route-widgets/ReservedAliasDetailRoute/AliasUsersList.tsx index a5ca752..75c549a 100644 --- a/src/route-widgets/ReservedAliasDetailRoute/AliasUsersList.tsx +++ b/src/route-widgets/ReservedAliasDetailRoute/AliasUsersList.tsx @@ -114,7 +114,7 @@ export default function AliasUsersList({users, queryKey, id}: AliasUsersListProp try { await mutateAsync(values.users) } catch (error) { - setErrors(parseFastAPIError(error as AxiosError)) + setErrors(parseFastAPIError(error as AxiosError) as any) } }, })