Skip to content

Commit

Permalink
refactor: ForwardBubble type
Browse files Browse the repository at this point in the history
  • Loading branch information
YumoImer committed Jan 7, 2025
1 parent b77ecaa commit 28ef7b8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions components/bubble/Bubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useXComponentConfig from '../_util/hooks/use-x-component-config';
import { useXProviderContext } from '../x-provider';
import useTypedEffect from './hooks/useTypedEffect';
import useTypingConfig from './hooks/useTypingConfig';
import type { BubbleProps } from './interface';
import type { BubbleContentType, BubbleProps } from './interface';
import Loading from './loading';
import useStyle from './style';

Expand Down Expand Up @@ -213,10 +213,14 @@ const Bubble: React.ForwardRefRenderFunction<BubbleRef, BubbleProps> = (props, r
);
};

type ForwardBubbleType = <T extends BubbleContentType = string>(
props: BubbleProps<T> & { ref?: React.Ref<BubbleRef> },
) => React.ReactElement;

const ForwardBubble = React.forwardRef(Bubble);

if (process.env.NODE_ENV !== 'production') {
ForwardBubble.displayName = 'Bubble';
}

export default ForwardBubble;
export default ForwardBubble as ForwardBubbleType;

0 comments on commit 28ef7b8

Please sign in to comment.