Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import type error - Coud not find declaration file #260

Open
Reterics opened this issue Sep 9, 2024 · 0 comments
Open

Import type error - Coud not find declaration file #260

Reterics opened this issue Sep 9, 2024 · 0 comments

Comments

@Reterics
Copy link

Reterics commented Sep 9, 2024

Context

  • Qalendar Version: v3.8.1
  • vue-tsc: 5.0.29
  • IDE: Webstorm 2024.1.5

Description

IDE throws an error that "Vue: Could not find a declaration file for module qalendar"

image

Reason:
In node_module folder, the qalendar/dist/src does not have qalendar.vue that the index.d.ts refers to.
image
image

To Reproduce

  • Create a Vue + Typescript app with Vite
  • Install Qalendar with npm or pnpm
  • Try to import it in a Composite API .vue file

Temporary Workaround

I created a custom module declaration in vite-env.d.ts file to override the default one.

declare module 'qalendar' {
    import { DefineComponent } from 'vue';
    const Qalendar: DefineComponent<{}, {}, any>;
    const DatePicker: DefineComponent<{}, {}, any>;
    export {
        Qalendar,
        DatePicker
    };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant