MorevM / vue-transitions

Interface transitions library for Vue 2/3
https://morevm.github.io/vue-transitions/
MIT License
198 stars 5 forks source link

Could not find a declaration file for module #255

Closed ignissak closed 8 months ago

ignissak commented 10 months ago

Actual behavior

Importing VueTransitions shows TS error.

Expected behavior

Importing should be fine.

Steps to reproduce

main.ts:

import './assets/main.css';

import { createPinia } from 'pinia';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
import { createApp } from 'vue';
import VueTransitions from '@morev/vue-transitions';
import '@morev/vue-transitions/styles';

import App from './App.vue';
import router from './router';

const app = createApp(App);

const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);

app.use(pinia);
app.use(router);
app.use(VueTransitions);

app.mount('#app');

Error:

Could not find a declaration file for module '@morev/vue-transitions'. '.../node_modules/.pnpm/@morev+vue-transitions@2.3.6_vue@3.4.8/node_modules/@morev/vue-transitions/dist/vue-transitions.es.js' implicitly has an 'any' type.
  There are types at '.../node_modules/@morev/vue-transitions/types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@morev/vue-transitions' library may need to update its package.json or typings.ts(7016)

Environment

Additional context

No response

Possible solution

No response

MorevM commented 10 months ago

@ignissak Good day,

Thanks for the issue, the problem is clear. I'll try to make the changes this weekend. I'll ping you when this is resolved. :)

ignissak commented 9 months ago

Since there is no fix yet, this is a workaround:

  1. Create your own types file (for example types.d.ts) inside your src.
  2. Copy this code:
    declare module '@morev/vue-transitions' {
    const VueTransitions: any;
    export default VueTransitions;
    }
MorevM commented 9 months ago

@ignissak Thank you for posting a workaround and I apologize for not being able to make the change yet. Low energy, limited time, a lot of things to do... Someday I'll clean this place up :)

MorevM commented 8 months ago

@ignissak

This should be fixed with 3.0.1 release, thank you for pointing it out. Let me know if you are still experiencing any issues :)