Skip to content

Commit

Permalink
fix(react): fix typings of components
Browse files Browse the repository at this point in the history
  • Loading branch information
Grsmto committed Feb 25, 2023
1 parent 40e90b8 commit 25940e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/react/src/SnapCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,18 @@ export const SnapCarousel = React.forwardRef(

SnapCarousel.displayName = 'SnapCarousel';

type IndicatorProps<T extends ElementType> = {
type CommonProps<T extends ElementType> = {
children?: React.ReactNode;
className?: string;
tag?: T;
index: number;
activeIndex?: number;
state?: State;
};

interface IndicatorProps<T extends ElementType> extends CommonProps<T> {
index: number;
}

export const SnapCarouselIndicator = React.forwardRef(
<T extends ElementType = 'button'>(
{
Expand Down Expand Up @@ -135,7 +138,7 @@ export const SnapCarouselNavPrev = React.forwardRef(
className = '',
state,
...otherProps
}: IndicatorProps<T>,
}: CommonProps<T>,
ref?: PolymorphicRef<T>
) => {
const RootTag = tag || 'button';
Expand Down Expand Up @@ -178,7 +181,7 @@ export const SnapCarouselNavNext = React.forwardRef(
className = '',
state,
...otherProps
}: IndicatorProps<T>,
}: CommonProps<T>,
ref?: PolymorphicRef<T>
) => {
const RootTag = tag || 'button';
Expand Down

0 comments on commit 25940e4

Please sign in to comment.