diff --git a/examples/visualization/src/app/react-dom/FadeIn/page.tsx b/examples/visualization/src/app/react-dom/FadeIn/page.tsx index 8ddcf1439..aeecb96e4 100644 --- a/examples/visualization/src/app/react-dom/FadeIn/page.tsx +++ b/examples/visualization/src/app/react-dom/FadeIn/page.tsx @@ -29,40 +29,47 @@ const query = { } export default function Page() { - const userId = 1 - return ( - <>{error.message}}> - - {skeleton} - - } - > - - {({ data: user }) => ( - -

{user.username}

-

{user.userAgent}

-

{user.age}

-

{user.maidenName}

-
- )} -
-
-
+
+ <>{error.message}}> + {Array.from({ length: 20 }).map((_, i) => { + const userId = i + 1 + return ( + + {skeleton} + + } + > + + {({ data: user }) => ( + +

{user.username}

+

{user.userAgent}

+

{user.age}

+

{user.maidenName}

+
+ + )} + + + ) + })} + +
) } const skeleton = ( -
-
-
-
-
-
-
+
+
+
+
+
+
+
) diff --git a/packages/react-dom/src/FadeIn.test-d.tsx b/packages/react-dom/src/FadeIn.test-d.tsx new file mode 100644 index 000000000..49f8282ce --- /dev/null +++ b/packages/react-dom/src/FadeIn.test-d.tsx @@ -0,0 +1,17 @@ +import { FadeIn } from './FadeIn' + +describe('', () => { + // eslint-disable-next-line vitest/expect-expect + it('type check', () => { + // @ts-expect-error ts(2322) + ;(() => )() + ;(() => )() + ;(() => )() + ;(() => )() + // @ts-expect-error ts(2322) + ;(() => )() + }) +}) + +const Example1 = ({}: { x: string }) => <> +const Example2 = () => <> diff --git a/packages/react-dom/src/FadeIn.tsx b/packages/react-dom/src/FadeIn.tsx index 6f46aae6e..010dd3531 100644 --- a/packages/react-dom/src/FadeIn.tsx +++ b/packages/react-dom/src/FadeIn.tsx @@ -1,15 +1,24 @@ import { type CSSProperties, type ComponentPropsWithoutRef, type ElementType } from 'react' import { useInView } from './useInView' -type FadeInBaseProps = { +type FadeInProps = ComponentPropsWithoutRef & { + /** + * The element type to render. + */ + as?: TAs + /** + * The delay in milliseconds before the animation starts. + */ delay?: number + /** + * The duration in milliseconds of the animation. + */ duration?: number + /** + * The timing function of the animation. + */ timingFunction?: CSSProperties['animationTimingFunction'] } -type FadeInProps = { - as?: TAs -} & Omit, 'as' | keyof FadInBaseProps> & - FadeInBaseProps export function FadeIn({ as,