Fixed most ts-ignore stuff

This commit is contained in:
Kloon ImKloon 2023-09-12 16:13:15 +02:00
parent 45ccec72d3
commit d2e81a6e77
No known key found for this signature in database
GPG Key ID: CCF1C86A995C5B6A

View File

@ -1,7 +1,11 @@
import { disableExternal } from "@/utils/constants"; import { disableExternal } from "@/utils/constants";
import { createApp } from "vue"; import { createApp } from "vue";
import VueLazyload from "vue-lazyload"; import VueLazyload from "vue-lazyload";
import Toast, { useToast } from "vue-toastification"; import Toast, { POSITION, useToast } from "vue-toastification";
import {
ToastOptions,
PluginOptions,
} from "vue-toastification/dist/types/types";
import createPinia from "@/stores"; import createPinia from "@/stores";
import router from "@/router"; import router from "@/router";
import i18n, { rtlLanguages } from "@/i18n"; import i18n, { rtlLanguages } from "@/i18n";
@ -12,6 +16,7 @@ import dayjs from "dayjs";
import localizedFormat from "dayjs/plugin/localizedFormat"; import localizedFormat from "dayjs/plugin/localizedFormat";
import relativeTime from "dayjs/plugin/relativeTime"; import relativeTime from "dayjs/plugin/relativeTime";
import duration from "dayjs/plugin/duration"; import duration from "dayjs/plugin/duration";
import "./css/styles.css"; import "./css/styles.css";
// register dayjs plugins globally // register dayjs plugins globally
@ -28,7 +33,7 @@ app.use(Toast, {
transition: "Vue-Toastification__bounce", transition: "Vue-Toastification__bounce",
maxToasts: 10, maxToasts: 10,
newestOnTop: true, newestOnTop: true,
}); } satisfies PluginOptions);
app.use(i18n); app.use(i18n);
app.use(pinia); app.use(pinia);
@ -50,7 +55,7 @@ app.directive("focus", {
}); });
const toastConfig = { const toastConfig = {
position: "bottom-center", position: POSITION.BOTTOM_CENTER,
timeout: 4000, timeout: 4000,
closeOnClick: true, closeOnClick: true,
pauseOnFocusLoss: true, pauseOnFocusLoss: true,
@ -61,7 +66,7 @@ const toastConfig = {
hideProgressBar: false, hideProgressBar: false,
closeButton: "button", closeButton: "button",
icon: true, icon: true,
}; } satisfies ToastOptions;
app.provide("$showSuccess", (message: string) => { app.provide("$showSuccess", (message: string) => {
const $toast = useToast(); const $toast = useToast();
@ -72,8 +77,6 @@ app.provide("$showSuccess", (message: string) => {
message: message, message: message,
}, },
}, },
// their type defs are messed up
//@ts-ignore
{ ...toastConfig, rtl: rtlLanguages.includes(i18n.global.locale) } { ...toastConfig, rtl: rtlLanguages.includes(i18n.global.locale) }
); );
}); });
@ -86,13 +89,10 @@ app.provide("$showError", (error: Error | string, displayReport = true) => {
props: { props: {
message: (error as Error).message || error, message: (error as Error).message || error,
isReport: !disableExternal && displayReport, isReport: !disableExternal && displayReport,
// TODO: i couldnt use $t inside the component // TODO: could you add this to the component itself?
//@ts-ignore
reportText: i18n.global.t("buttons.reportIssue"), reportText: i18n.global.t("buttons.reportIssue"),
}, },
}, },
// their type defs are messed up
//@ts-ignore
{ {
...toastConfig, ...toastConfig,
timeout: 0, timeout: 0,