HJ29 / vue3-tabs

A touch swipe tabs for vue 3
39 stars 7 forks source link

It does not works with vue3-typescript raise error Could not find a declaration file for module 'vue3-tabs' #5

Closed tony95271 closed 3 years ago

tony95271 commented 3 years ago

my package.json

//...
  "dependencies": {
    "core-js": "^3.6.5",
    "vue": "^3.0.0",
    "vue-class-component": "^8.0.0-0",
    "vue-router": "^4.0.0-0",
    "vuex": "^4.0.0-0"
  },
//...
HJ29 commented 3 years ago

can u share code about how u import and use the package?

tony95271 commented 3 years ago
<script lang="ts">
import { Options, Vue } from 'vue-class-component';
import { Tabs, Tab } from 'vue3-tabs-component';

// ...

I walking around this issue by

// @ts-ignore
import { Tabs, Tab } from 'vue3-tabs-component';
HJ29 commented 3 years ago

my package.json

//...
  "dependencies": {
    "core-js": "^3.6.5",
    "vue": "^3.0.0",
    "vue-class-component": "^8.0.0-0",
    "vue-router": "^4.0.0-0",
    "vuex": "^4.0.0-0"
  },
//...

did u npm i --save vue3-tabs or yarn add vue3-tabs vue3-tabs package doesn't appear in your package.json


<script lang="ts">
import { Options, Vue } from 'vue-class-component';
import { Tabs, Tab } from 'vue3-tabs-component';

// ...

I walking around this issue by

// @ts-ignore
import { Tabs, Tab } from 'vue3-tabs-component';

you should import vue3-tabs instead of vue3-tabs-component.

not sure if these are typo when u commenting here.


u said that u workaround the issue by using ts-ignore, does that means u successfully used this package? or u didn't? if it is working, then it is just a typescript issue, this package doesn't write with strict typescript rule, so it might conflict with your typescript config. if you have shims-vue.d.ts in your project root. add the following code and restart your ide.

// shims-vue.d.ts
...
declare module 'vue3-tabs';

if u don't have shims-vue.d.ts create a file named [any name].d.ts and do the samething above. https://stackoverflow.com/a/49259337/13703967