Skip to content
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

vue-horizontal@next not yet support TS (Vue3) ? #126

Open
renogies opened this issue Nov 13, 2023 · 2 comments
Open

vue-horizontal@next not yet support TS (Vue3) ? #126

renogies opened this issue Nov 13, 2023 · 2 comments

Comments

@renogies
Copy link

vue-horizontal@next not yet support TS (Vue3) ?

@renogies
Copy link
Author

renogies commented Nov 13, 2023

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';

@linkurzweg
Copy link

linkurzweg commented Nov 29, 2023

@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
}

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

2 participants