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

Typescript support #15

Open
fenriquegimenez-zz opened this issue Apr 5, 2022 · 1 comment
Open

Typescript support #15

fenriquegimenez-zz opened this issue Apr 5, 2022 · 1 comment

Comments

@fenriquegimenez-zz
Copy link

Hi guys, excellent work! I wonder if it's on the plans to add typescript support? Thanks!

@danielbonifacio
Copy link

to get typescript support, create a file called react-grid-carousel.d.ts under the project @types or root directory with this content:

declare module "react-grid-carousel" {
  export default Carousel;
  declare function Carousel({
    cols,
    rows,
    gap,
    loop,
    scrollSnap,
    hideArrow,
    showDots,
    autoplay,
    dotColorActive,
    dotColorInactive,
    responsiveLayout,
    mobileBreakpoint,
    arrowLeft,
    arrowRight,
    dot,
    containerClassName,
    containerStyle,
    children,
  }: {
    cols?: number;
    rows?: number;
    gap?: number;
    loop?: boolean;
    scrollSnap?: boolean;
    hideArrow?: boolean;
    showDots?: boolean;
    autoplay: any;
    dotColorActive?: string;
    dotColorInactive?: string;
    responsiveLayout: any;
    mobileBreakpoint?: number;
    arrowLeft: any;
    arrowRight: any;
    dot: any;
    containerClassName?: string;
    containerStyle?: {};
    children: any;
  }): JSX.Element;
  declare namespace Carousel {
    namespace propTypes {
      export { positiveNumberValidator as cols };
      export { positiveNumberValidator as rows };
      export const gap: any;
      export const loop: any;
      export const scrollSnap: any;
      export const hideArrow: any;
      export const showDots: any;
      export const autoplay: any;
      export const dotColorActive: any;
      export const dotColorInactive: any;
      export const responsiveLayout: any;
      export const mobileBreakpoint: any;
      export const arrowLeft: any;
      export const arrowRight: any;
      export const dot: any;
      export const containerClassName: any;
      export const containerStyle: any;
    }
    function Item({ children }: { children: any }): any;
    namespace Item {
      export { CAROUSEL_ITEM as displayName };
    }
  }
  declare function positiveNumberValidator(
    props: any,
    propName: any,
    componentName: any
  ): Error;
  declare const CAROUSEL_ITEM: "CAROUSEL_ITEM";
}

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