vue-horizontal
vue-horizontal copied to clipboard
vue-horizontal@next not yet support TS (Vue3) ?
vue-horizontal@next not yet support TS (Vue3) ?
src/main.ts:13:27 - error TS7016: Could not find a declaration file for module 'vue-horizontal'. 'C:/Github/project-vue3/node_modules/vue-horizontal/dist/vue-horizontal.umd.js' implicitly has an 'any' type.
Try npm i --save-dev @types/vue-horizontal
if it exists or add a new declaration (.d.ts) file containing declare module 'vue-horizontal';
13 import VueHorizontal from 'vue-horizontal';
@renogies I managed to get around this by creating a declaration file like this. Make sure to have the file or the directory where you put it in your includes in the tsconfig.json.
vue-horizontal.d.ts:
declare module 'vue-horizontal' {
import { DefineComponent } from 'vue'
const VueHorizontal: DefineComponent<
{
button?: boolean
buttonBetween?: boolean
scroll?: boolean
responsive?: boolean
displacement?: number
snap?: 'start' | 'center' | 'end' | 'none'
},
{
prev: () => void
next: () => void
scrollToIndex: (index: number) => void
scrollToLeft: (distance: number, scrollBehavior: 'smooth' | 'auto') => void
refresh: () => void
}
>
export default VueHorizontal
}