vue-splide icon indicating copy to clipboard operation
vue-splide copied to clipboard

Typescript declaration problem ts(7016)

Open gmqiyue opened this issue 2 years ago • 1 comments

Checks

  • [X] Not a duplicate.
  • [X] Not a question, feature request, or anything other than a bug report directly related to Vue Splide. Use Discussions for these topics: https://github.com/Splidejs/splide/discussions

Version

0.6.12

Description

I have created a Vue3+TS project, and when I tried to use the @splidejs/vue-splide module in the project, I encountered the following error:

Could not find a declaration file for module '@splidejs/vue-splide'. '/project_root/node_modules/.pnpm/@[email protected]/node_modules/@splidejs/vue-splide/dist/js/vue-splide.esm.js' implicitly has an 'any' type. There are types at '/project_root/node_modules/@splidejs/vue-splide/src/js/index.ts', but this result could not be resolved when respecting package.json "exports". The '@splidejs/vue-splide' library may need to update its package.json or typings.ts(7016)

I referred to the package.json configuration of @splidejs/splide, and it seems to be an issue with the exports field. Here are the details:

"exports": {
    ".": {
      "require": "./dist/js/vue-splide.cjs.js",
      "import": "./dist/js/vue-splide.esm.js",
      "default": "./dist/js/vue-splide.esm.js"
    },
    "./css": "./dist/css/splide.min.css",
    "./css/core": "./dist/css/splide-core.min.css",
    "./css/*": "./dist/css/themes/splide-*.min.css"
  }

The current version of exports does not include the types field in the default export. If possible, I will submit a pull request to address this issue.

Reproduction Link

No response

Steps to Reproduce

  1. Create Vue 3 Typescript project
  2. Install @splidejs/vue-splide
  3. Setup component containing Splide and SplideSlide

Expected Behaviour

Without TypeError.

gmqiyue avatar Jun 03 '23 05:06 gmqiyue

same error here

mojjjtaba avatar Jun 05 '24 15:06 mojjjtaba