NightCatSama/vue-slider-component

[vue3.x] TypeScript Build Error

recallwei opened this issue ยท 9 comments

When I publish the site to vercel, the build failed error occurred. It seems like TypeScript error.

The error message is below.

ef97b3a789d0d7b12b6118d5458cb6f

Also, you can fork my repository (https://github.com/recallwei/resume-generator) and run pnpm install then pnpm build, and can find the build error message.

Environment

  • OS & Version: [ macOS, Windows 11 ]
  • Vue version: [v3.2.39]
  • Component Version: [ v4.1.0-beta.2 ]

Having the same issue

Try to set skipLibCheck in tsconfig to true.

Add skipLibCheck in tsconfig does't work for me.
I remove the vue-tsc --noEmit TypeScript check in the build script temporarily.
That works.

@recallwei Is node_modules excluded from tsconfig? Normally, components in node_modules should not be type checked.

"exclude": [
    "node_modules"
]

My config also included skipLibCheck and "exclude": [ "node_modules" ], but getting the error, too. Maybe a bug in vue-tsc?

Yes, I got the same result even after adding "exclude": [ "node_modules" ].

Temporarily fixed it by

// stub/vue-slider-component.d.ts
// This needs to be stubbed until the vue-slider-component library fix their types
// https://github.com/johnsoncodehk/volar/issues/2018

export { DefineComponent } from 'vue';

and

 "paths": {
      "@/*": ["src/*"],
      "vue-slider-component": ["stubs/vue-slider-component.d.ts"]
    },

in tsconfig.json

sifex commented

If anyone else is struggling with this one, answer found in #652

npm install vue-slider-component@4.1.0-beta.6

still seems an issue in 4.1.0-beta.7. Downgrading to 4.1.0-beta.6 did not help. Config already includes skipLibCheck and excludes node_modules. Only thing that helped was stubbing out the .d.ts file @Blackfaded mentioned