Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Found ts declaration file but could not be resolved. #86

Open
colinbes opened this issue Jun 8, 2023 · 2 comments
Open

Found ts declaration file but could not be resolved. #86

colinbes opened this issue Jun 8, 2023 · 2 comments

Comments

@colinbes
Copy link

colinbes commented Jun 8, 2023

I am using vscode 1.78.2 together with vue 3.2.47 and latest vite.

I installed latest sortablejs-vue3 (1.2.9) as per instructions and am seeing error below.

I do see node_modules/sortablejs-vue3/dist/src/components/Sortable.vue.d.ts and the referred to node_modules/sortablejs-vue3/dist/types/main.d.ts but do not understand the comment on his result could not be resolved when respecting package.json

Could not find a declaration file for module 'sortablejs-vue3'. '/Users/colinbester/SynologyDrive/vite/recipe-manager/node_modules/sortablejs-vue3/dist/sortablejs-vue3.es.js' implicitly has an 'any' type.
  There are types at '/Users/colinbester/SynologyDrive/vite/recipe-manager/node_modules/sortablejs-vue3/dist/types/main.d.ts', but this result could not be resolved when respecting package.json "exports". The 'sortablejs-vue3' library may need to update its package.json or typings.ts(7016)

My vite tsconfig.json is setup under compilerOptions to use moduleResolution: "bundler"

Assistance appreciated.

@neecto
Copy link

neecto commented Sep 22, 2023

Hey, I have the same issue with
vite 4.3.9, vue 3.2.47

It seems to be just VS code issue, since the app build is successful and the package itself works. But still would be nice to know how to solve it.

@colinbes have you found a solution by any chance?

@bbugh
Copy link

bbugh commented Oct 16, 2023

A fix for this was already accepted in PR #84, we just need a new release to resolve the issue. @MaxLeiter what do you think about doing a point release of main to resolve this? It's the only new commit since the last release.

In the mean time if you are using npm or yarn you can use patch-package, or the built in pnpm patch with pnpm:

# patches/[email protected]
diff --git a/package.json b/package.json
index 3092135c4b05748637ac0ca9fd4bde790a46ebca..54810888f0b88f5ee4d3ae3635e15a8c74c7dd77 100644
--- a/package.json
+++ b/package.json
@@ -30,6 +30,7 @@
   "module": "./dist/sortablejs-vue3.es.js",
   "exports": {
     ".": {
+      "types": "./dist/types/main.d.ts",
       "import": "./dist/sortablejs-vue3.es.js",
       "require": "./dist/sortablejs-vue3.umd.js"
     }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants