You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using this component in our design system library and ran into type errors in our own repo and in our consumer repos that we traced back to this line.
In short, importing a Vue component in a .d.ts file did not allow that file to be excluded from type checking with vue-tsc, and we saw errors like this one.
> 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
In our library, we fixed this issue by overriding index.d.ts with our own vue-slider-component.d.ts file that exports the type Vue.ComponentOptions<Vue> as the default export rather than the component itself. https://012.vuejs.org/api/options.html
import Vue from 'vue';
declare module 'vue-slider-component' {
export default Vue.ComponentOptions<Vue>;
... everything else from lib/typings/index.d.ts
}
If this is an issue for anyone else, I would recommend updating this export in the .d.ts file to export a Vue component type rather than the component instance. Since this is a small change, I'm happy to open this PR if it is helpful.
Environment (If you feel unrelated, please delete the block)
OS & Version: macOS
Vue version: v3.2.0
Component Version: v4.1.0-beta.7
The text was updated successfully, but these errors were encountered:
Describe the bug
We are using this component in our design system library and ran into type errors in our own repo and in our consumer repos that we traced back to this line.
vue-slider-component/lib/typings/index.d.ts
Line 78 in 061e4f4
In short, importing a Vue component in a
.d.ts
file did not allow that file to be excluded from type checking withvue-tsc
, and we saw errors like this one.In our library, we fixed this issue by overriding
index.d.ts
with our ownvue-slider-component.d.ts
file that exports the typeVue.ComponentOptions<Vue>
as the default export rather than the component itself. https://012.vuejs.org/api/options.htmlIn
tsconfig.json
:If this is an issue for anyone else, I would recommend updating this export in the
.d.ts
file to export a Vue component type rather than the component instance. Since this is a small change, I'm happy to open this PR if it is helpful.Environment (If you feel unrelated, please delete the block)
The text was updated successfully, but these errors were encountered: