Skip to content

Typescript declaration problem ts(7016) #91

Open
@gmqiyue

Description

@gmqiyue

Checks

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/@Splidejs+vue-splide@0.6.12/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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions