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

error TS2688: Cannot find type definition file for '.vue-global-types/vue_3.5_false.d.ts' #4963

Closed
Mivik opened this issue Oct 30, 2024 · 8 comments · Fixed by #4966
Closed
Labels
bug Something isn't working upstream: typescript

Comments

@Mivik
Copy link

Mivik commented Oct 30, 2024

Vue - Official extension or vue-tsc version

2.1.8

VSCode version

1.94.2

Vue version

3.5.12

TypeScript version

5.4.5

System Info

System:
    OS: Linux 6.11 Arch Linux
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
    Memory: 22.45 GB / 31.04 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 20.18.0 - /usr/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 10.9.0 - /usr/bin/npm
    bun: 1.1.33 - ~/.bun/bin/bun

package.json dependencies

{
  "dependencies": {
    "pinia": "^2.2.4",
    "vue": "^3.5.12",
    "vue-router": "^4.4.5"
  },
  "devDependencies": {
    "@rushstack/eslint-patch": "^1.10.4",
    "@tsconfig/node20": "^20.1.4",
    "@types/node": "^20.17.1",
    "@vitejs/plugin-vue": "^5.1.4",
    "@vue/eslint-config-prettier": "^9.0.0",
    "@vue/eslint-config-typescript": "^13.0.0",
    "@vue/tsconfig": "^0.5.1",
    "eslint": "^8.57.1",
    "eslint-plugin-vue": "^9.29.1",
    "npm-run-all2": "^6.2.6",
    "prettier": "^3.3.3",
    "typescript": "~5.4.5",
    "vite": "^5.4.10",
    "vue-tsc": "^2.1.8"
  }
}

Steps to reproduce

Use vue-tsc 2.1.8 and type-check the project

What is expected?

type-check should run without errors

What is actually happening?

type-check failed with

error TS2688: Cannot find type definition file for '/path/to/project/node_modules/.vue-global-types/vue_3.5_false.d.ts'.

30 /// <reference types="/path/to/project/node_modules/.vue-global-types/vue_3.5_false.d.ts" />

See #4924 (comment)

Link to minimal reproduction

https://github.com/Mivik/vue-lang-tool-reproduce

Any additional comments?

This issue was said to be fixed in #4924, however this PR introduced the very same problem for me. Using vue-tsc 2.1.6 does not yield this error.

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Oct 30, 2024

Does the /path/to/project/node_modules/.vue-global-types/vue_3.5_false.d.ts file exist on your file system?
If yes, you can reproduce the error by writing /// <reference types="/path/to/project/node_modules/.vue-global-types/vue_3.5_false.d.ts" /> in any .ts file?

@Mivik
Copy link
Author

Mivik commented Oct 30, 2024

Okay, I narrowed down the issue. The path got automatically lowercased which causes the issue to happen only if the project path contains uppercase letters.

src/App.vue:8:23 - error TS2688: Cannot find type definition file for '/home/mivik/test/repro/node_modules/.vue-global-types/vue_3.5_false.d.ts'.

8 /// <reference types="/home/mivik/Test/repro/node_modules/.vue-global-types/vue_3.5_false.d.ts" />

@johnsoncodehk
Copy link
Member

Did you mean /// <reference types="/home/mivik/Test/repro/node_modules/.vue-global-types/vue_3.5_false.d.ts" /> case is correct, but somehow when type checking it converted to lowercase?

What is the typescript version in your node_modules? Will upgrading to the latest version solve the problem?

@johnsoncodehk
Copy link
Member

@Mivik can you help us remotely investigate this issue?

https://github.com/vuejs/language-tools/wiki/Help-Us-Investigate-Issues-Remotely

@Mivik
Copy link
Author

Mivik commented Oct 30, 2024

Did you mean /// <reference types="/home/mivik/Test/repro/node_modules/.vue-global-types/vue_3.5_false.d.ts" /> case is correct, but somehow when type checking it converted to lowercase?

What is the typescript version in your node_modules? Will upgrading to the latest version solve the problem?

Yes the path exists and it's converted to lowercase during type checking

Typescript version is 5.4.5.

BTW I think probably check #4924 since using absolute path for global types fixes a specific issue and switching back to relative path might break that promise.

@KazariEX
Copy link
Collaborator

This is due to the issue of inconsistent path resolving behavior caused by older versions of Typescript, which can result in incorrect lowercase path name in case sensitive systems.

@NicolasPL64
Copy link

This is due to the issue of inconsistent path resolving behavior caused by older versions of Typescript, which can result in incorrect lowercase path name in case sensitive systems.

So the solution is...?
(also, is there any workaround for now?)

@KazariEX
Copy link
Collaborator

KazariEX commented Oct 31, 2024

The fix has been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream: typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants