NightCatSama / vue-slider-component

🌡 A highly customized slider component
https://nightcatsama.github.io/vue-slider-component
MIT License
2.41k stars 346 forks source link

[vue3.x] Typescript Errors #544

Closed Penguinlay closed 2 years ago

Penguinlay commented 3 years ago

Describe the bug

Multiple Typescript errors show up upon running type checking tool: vue-tsc. Implement the component, install vue-tsc, vite and this package's peer dependency vue-class-component all of Vue 3 compatible versions, and then run yarn vue-tsc --noEmit in the terminal.

Additional context (yarn vue-tsc --noEmit Printout)

node_modules/vite/client.d.ts:89:18 - error TS2300: Duplicate identifier 'css'.

89   export default css
                    ~~~

  node_modules/vue-slider-component/typings/typings/global.d.ts:22:18
    22   export default content
                        ~~~~~~~
    'css' was also declared here.

node_modules/vue-slider-component/typings/typings/global.d.ts:8:36 - error TS2709: Cannot use namespace 'Vue' as a type.

8     interface ElementClass extends Vue {}
                                     ~~~

node_modules/vue-slider-component/typings/typings/global.d.ts:22:3 - error TS2666: Exports and export assignments are not permitted in module augmentations.

22   export default content
     ~~~~~~

node_modules/vue-slider-component/typings/typings/global.d.ts:22:18 - error TS2300: Duplicate identifier 'css'.

22   export default content
                    ~~~~~~~

  node_modules/vite/client.d.ts:89:18
    89   export default css
                        ~~~
    'css' was also declared here.

My package.json

    "dependencies": {
        "axios": "0.21.1",
        "markdown-it-link-attributes": "3.0.0",
        "vue": "3.1.0-beta.7",
        "vue-axios": "3.2.4",
        "vue-class-component": "8.0.0-rc.1",
        "vue-i18n": "9.2.0-alpha.3",
        "vue-meta": "3.0.0-alpha.7",
        "vue-router": "4.0.8",
        "vue-slider-component": "4.0.0-beta.3",
        "vue3-markdown-it": "1.0.8",
        "vuex": "4.0.1"
    },
    "devDependencies": {
        "@intlify/vite-plugin-vue-i18n": "2.1.2",
        "@octokit/types": "6.16.2",
        "@types/markdown-it-link-attributes": "3.0.1",
        "@vitejs/plugin-legacy": "1.4.1",
        "@vitejs/plugin-vue": "1.2.3",
        "@vue/compiler-sfc": "3.1.0-beta.7",
        "pre-commit": "1.2.2",
        "prettier": "2.3.0",
        "sass": "1.34.1",
        "typescript": "4.4.0-dev.20210602",
        "vite": "2.3.6",
        "vite-plugin-package-version": "1.0.2",
        "vue-tsc": "0.1.7"
    },
Penguinlay commented 3 years ago

I am not that familiar with implementing d.ts, and I'm quite occupied these days. So, if anyone wants to take on this project, please feel free to do so!

mwidmann commented 3 years ago

Did you manage to fix this somehow, @Penguinlay ? I'm facing the same issues.

Penguinlay commented 3 years ago

Did you manage to fix this somehow, @Penguinlay ? I'm facing the same issues.

Hey, unfortunately, not yet.

NightCatSama commented 2 years ago

The latest version uses the .vue format to implement the component, so there should not be this problem anymore.

vovaleontiev commented 2 years ago

"vue-slider-component": "^4.1.0-beta.1"

The error is still here

NightCatSama commented 2 years ago

@vovaleontiev Try to ignore duplicate type definitions in tsconfig.json.

vovaleontiev commented 2 years ago
"compilerOptions": {
  "skipLibCheck": true,
  // ...
}

I added this to my tsconfig file. And it helped me 👍