I am currently in the process of developing a new Plugin for Vue 3 using Typescript.
Here is an overview of my code:
//somePlugin
import { App, Plugin } from "vue";
const somePlugin: Plugin = {
install: async (app: App, options: {...}): Promise<void> => {
....
}
}
export { somePlugin };
//----------------------------------------------------------
//main.ts
import { somePlugin } from "@/plugins/somePlugin";
import App from "./App.vue";
const app = createApp(App);
app.use(somePlugin);
Despite my efforts, I encountered the following Error:
Cannot find module '@/plugins/somePlugin' or its corresponding type declarations.ts(2307)
As someone who is relatively new to Typescript, my understanding was that "somePlugin" should be well-defined due to its association with the Vue internal "Plugin."
Upon exploring solutions provided for similar issues, I attempted creating a "somePlugin.d.ts" file, but was uncertain about what exactly to declare within. My initial attempt looked like this:
declare module "somePlugin";
Unfortunately, this approach did not yield the desired results. As such, I am seeking guidance on how to properly declare the Plugin so it can function without resorting to using ts-ignore.