Open yangricardo opened 4 years ago
Yep I had the same problem on my project. It's because the breakpoint type is not good. If you change your node modules types to :
interface CarouselBreakpoint {
[breakpointNumber: number]: Pick<CarouselProps, Exclude<keyof CarouselProps, "breakpoints">>
}
export interface CarouselProps {
itemWidth?: number;
value?: number;
onChange?(value: number): void;
slides?: JSX.Element[];
offset?: number;
draggable?: boolean;
animationSpeed?: number;
className?: string;
breakpoints?: CarouselBreakpoint;
plugins?: Array<string|CarouselPluginTypes>;
}
It will work properly :)
I will propose a PR soon to fix it !
hi @qchuchu, is there any update on that?
On the latest versions I still get the typing breakpoints?: Pick<CarouselProps, Exclude<keyof CarouselProps, "breakpoints" | "plugins">>;
which doesn't seem to work.
Hi, @qchuchu do you have any updates regarding breakpoints?
this issues does not slove yet, sad :/
I just created a PR on DefinitelyTyped : https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55862 - I'm kinda of new to this but I think I did it the right way. Maybe if you can upvote it, that would help to give more visibility ;)
Sorry for the delay, as I had a short notice to finish my project last time, I decided to use another library. But I think we need to make this change as it keeps annoying people ;)
My PR has been merged ! You should be able to use breakpoints now ;) You just need to upgrade your @types/brainhubeu__react-carousel, and I think we can close this issue :)
Hi, I' am trying to use this lib in a typescript application. When i try to define the breakpoints, it fails to transpile from typescript with the following error:
My code is:
The Client component is just a div with a Card like layout. Without the breakpoint, it works.
Another thing i found, is the interface:
It's like there is something missing, to use the set breakpoint numbers properly, but i'm not sure...