Skip to content

Throwing ERROR(vue-tsc) from an external library #3458

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

Closed
AlanLes opened this issue Jul 31, 2023 · 6 comments
Closed

Throwing ERROR(vue-tsc) from an external library #3458

AlanLes opened this issue Jul 31, 2023 · 6 comments

Comments

@AlanLes
Copy link

AlanLes commented Jul 31, 2023

Hello, after updating vue-tsc to 1.8.8 in one of the projects, I'm having problems with it throwing an error from an external library. When the project runs with vite, the vue-tsc throws an error from the external open-source component-library. This library is based on a different vue-tsc version, but I think it shouldn't be an issue (it's an external library after all), should it? I think the skipLibCheck flag in the tsconfig.json should do the job, but for some reason it doesn't.

The tsconfig in the project is the following:

{
  "compilerOptions": {
    "outDir": "./dist",
    "allowJs": true,
    "esModuleInterop": true,
    "isolatedModules": true,
    "noImplicitAny": true,
    "jsx": "preserve",
    "lib": [
      "esnext",
      "dom",
      "dom.Iterable"
    ],
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "verbatimModuleSyntax": true,
    "importHelpers": true,
    "experimentalDecorators": true,
    "baseUrl": "./",
    "paths": {
      "@/*": [
        "src/*"
      ],
      "@customization/*": [
        "customization/*"
      ]
    },
    "skipLibCheck": true,
    "sourceMap": true,
    "strict": true,
    "target": "ESNext",
    "types": [
      "vitest/globals",
      "vite/client"
    ],
    "useDefineForClassFields": true
  },
  "include": [
    "src/**/*",
    "tests/**/*",
    "e2e/**/*",
    "stories/**/*",
    "scripts/**/*",
    "customization/**/*",
    "**/*.ts.vue",
    ".eslintrc.js",
    "vite.config.ts",
    "playwright.config.ts",
    "vite-plugins/*.ts"
  ]
}
@becbaile-te
Copy link

I am seeing this too. skipLibCheck is true and node_modules is in the excludes array, but I am still seeing errors related to node_modules.

> npx vue-tsc --project tsconfig.gen-dts.json --noEmit

node_modules/vue-slider-component/lib/utils/control.ts:554:22 - error TS6133: 'pos' is declared but its value is never read.

554     dotsPos.forEach((pos, i) => {
                         ~~~


Found 1 error in node_modules/vue-slider-component/lib/utils/control.ts:554

@prof-schnitzel
Copy link

This has nothing to do with vue-tsc, because this is a typescript limitation. If you import ts files from node_modules, it will be checked by typescript, no matter if skipLibCheck is set to true or not. You have to import transpiled javascript files, not ts files.

See the typescript issue: microsoft/TypeScript#40426

@AlanLes
Copy link
Author

AlanLes commented Sep 29, 2023

Yeeep, but I have those for the .vue files (which are obviously not .ts files), so what in this case?

@so1ve
Copy link
Member

so1ve commented Sep 29, 2023

I'm not sure if we can avoid this behavior: https://github.com/vuejs/language-tools/blob/master/packages/vue-tsc/bin/vue-tsc.js#L15-L17

Volar needs to patch tsc to include .vue files so they can get typechecked, which leads to this error

@desprit
Copy link

desprit commented Jan 8, 2024

I have no direct imports from the node_modules but still have that same issue in turbo monorepo.

@davidmatter
Copy link
Collaborator

Please check if this issue has been resolved in version 2.x. If not, feel free to create a new one.

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

6 participants