From 6ea877a1be72a0f4f9926de7f86d162374778f38 Mon Sep 17 00:00:00 2001 From: pandadev <70103896+0PandaDEV@users.noreply.github.com> Date: Wed, 5 Mar 2025 13:39:07 +0100 Subject: [PATCH] feat(types): improve type safety for history and plugin modules --- plugins/history.ts | 4 ++-- types/plugins.d.ts | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 types/plugins.d.ts diff --git a/plugins/history.ts b/plugins/history.ts index 934ded5..f96a5a6 100644 --- a/plugins/history.ts +++ b/plugins/history.ts @@ -1,5 +1,5 @@ import { invoke } from "@tauri-apps/api/core"; -import type { HistoryItem } from "~/types/types"; +import type { ContentType, HistoryItem } from "~/types/types"; export default defineNuxtPlugin(() => { return { @@ -37,7 +37,7 @@ export default defineNuxtPlugin(() => { async writeAndPaste(data: { content: string; - contentType: string; + contentType: ContentType; }): Promise { await invoke("write_and_paste", data); }, diff --git a/types/plugins.d.ts b/types/plugins.d.ts new file mode 100644 index 0000000..449f78b --- /dev/null +++ b/types/plugins.d.ts @@ -0,0 +1,8 @@ +import { HistoryItem, ContentType } from './types'; + +declare module '#app' { + interface NuxtApp { + $history: ReturnType['provide']['history']; + $settings: ReturnType['provide']['settings']; + } +} \ No newline at end of file