Skip to content

Add "types" to "exports" in package.json #23

@thomasaull

Description

@thomasaull

VS Code is complaining about a "wrong" configuration when using this package in a TypeScript project:

Could not find a declaration file for module '@vueuse/gesture'. '[…]/node_modules/.pnpm/@vueuse+gesture@2.0.0-beta.1_vue@3.3.4/node_modules/@vueuse/gesture/dist/index.mjs' implicitly has an 'any' type.
There are types at '[…]/node_modules/@vueuse/gesture/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@vueuse/gesture' library may need to update its package.json or typings.ts(7016)

It can be easily fixed by adding a reference to the types to the exports section:

"exports": {
  ".": {
    "import": "./dist/index.mjs",
    "require": "./dist/index.cjs",
    "types": "./dist/index.d.ts"
  }
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions