-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
swiper/vue missing type declarations #3916
Comments
If this helps anyone I wrote a skeleton typings file to get it to atleast work with a typescript vue project: swiper-t.d.tsdeclare module 'swiper/vue' {
import _Vue from 'vue';
export class Swiper extends _Vue {}
export class SwiperSlide extends _Vue {}
} |
@GerryWilko you're welcome to contribute :) |
@vltansky Apologies I meant to come back to this and create a PR. I just dropped this in as a comment temporarily. I'll raise a PR tomorrow! 😀 |
I've raised a PR for this file. I did a bit of testing and it didn't seem to affect the React typings. |
In the meantime, how we can use swiper in vue 3/typescript project? |
@NabilFr use this shim: declare module 'swiper/vue' {
import { DefineComponent } from 'vue'
export const Swiper: DefineComponent<any, any, any>
export const SwiperSlide: DefineComponent<any, any, any>
} |
@david50407 I think you should make a PR with this shim 👀 |
@giuliano-oliveira this shim only provides simple definition of |
Please, add full typscript support on vue in future releases. |
The proper (i.e. more maintainable) way to do this would probably be to convert the component to TypeScript. Having separate, manually written typings is a recipe for disaster in the long run, imo. I'd be willing to work on the conversion, if the maintainers are okay with it. I'll do some preliminary exploration on my end, based on how the Angular component builds itself, and report back once I have something. |
This is a (multiple allowed):
I see that Swiper has already types for
swiper/react
component included. I would be really cool to add type definitions forswiper/vue
component as well. This would allow us to integrate swiper in vue.js projects with typescript easier.I'm willing to work on this feature with a little guidance from maintainers.
The text was updated successfully, but these errors were encountered: