[vue3.x] Property 'prototype' is missing but required in type 'typeof VueSlider'
Coldsewoo opened this issue · 4 comments
Describe the bug
It throws a type error when used in template tag in vuejs 3 with typescript.
- when used without any context
<template>
<vueSlider />
</template>
<script setup lang="ts">
import vueSlider from 'vue-slider-component'
</script>
<style lang="scss" scoped></style>
Argument of type '{}' is not assignable to parameter of type 'typeof VueSlider & Omit<__VLS_GlobalAttrs, "prototype"> & Record<string, unknown>'.
Property 'prototype' is missing in type '{}' but required in type 'typeof VueSlider'.ts(2345)
- with params currently I am using
<vueSlider
v-model="currentFloor"
:data="floorList"
@change="setCurrentFloor"
direction="btt"
:lazy="false"
:data-label="'name'"
:data-value="'key'"
tooltip="always"
:tooltip-formatter="(v) => getTooltip(v)"
:marks="(val) => true"
:min="minMax.min"
:max="minMax.max"
hideLabel
included
/>
Argument of type '{ modelValue: any; data: any[]; direction: string; lazy: boolean; dataLabel: string; 'data-label': string; dataValue: string; 'data-value': string; tooltip: string; tooltipFormatter: (v: any) => any; 'tooltip-formatter': (v: any) => any; ... 4 more ...; included: true; }' is not assignable to parameter of type 'typeof VueSlider & Omit<__VLS_GlobalAttrs, "prototype"> & Record<string, unknown>'.
Property 'prototype' is missing in type '{ modelValue: any; data: any[]; direction: string; lazy: boolean; dataLabel: string; 'data-label': string; dataValue: string; 'data-value': string; tooltip: string; tooltipFormatter: (v: any) => any; 'tooltip-formatter': (v: any) => any; ... 4 more ...; included: true; }' but required in type 'typeof VueSlider'.ts(2345)
Environment (If you feel unrelated, please delete the block)
- OS & Version: Ubuntu 20.04
- Vue version: v3.0.7
- Component Version: v4.0.0-beta.4
- Typescript Version: v4.2.3
- Code editor: VS code
- vue extensions enabled: vscode-vue, Volar
- it is just a type error I think, it works normally when running
Where did this type come from, there is no such code in the project.
typeof VueSlider & Omit<__VLS_GlobalAttrs, "prototype"> & Record<string, unknown>
I didn't configure anything, just installed package and editor complained that type error.
and don't know why, the error disappears when I add
:prototype="vueSlider"
to props of vueSlider above
A guess, is it caused by the vscode plugin?
https://github.com/vuejs/vetur
https://github.com/vuejs/vetur/tree/master/server