perf: add type support to usePluginStore

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/3445/head
Ryan Wang 2022-07-18 16:12:54 +08:00
parent c15330f1e8
commit 82d966cba6
1 changed files with 7 additions and 3 deletions

View File

@ -1,12 +1,16 @@
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import type { Plugin } from "@halo-dev/api-client";
interface PluginStoreState {
plugins: Plugin[];
}
export const usePluginStore = defineStore("plugin", { export const usePluginStore = defineStore("plugin", {
state: () => ({ state: (): PluginStoreState => ({
plugins: [], plugins: [],
}), }),
actions: { actions: {
registerPlugin(plugin) { registerPlugin(plugin: Plugin) {
// @ts-ignore
this.plugins.push(plugin); this.plugins.push(plugin);
}, },
}, },