diff --git a/lib/components/grid/Grid.test.tsx b/lib/components/grid/Grid.test.tsx
index 391eb8ea..9c679ae4 100644
--- a/lib/components/grid/Grid.test.tsx
+++ b/lib/components/grid/Grid.test.tsx
@@ -168,7 +168,7 @@ describe("Grid", () => {
/>
);
- const NewCellComponent = vi.fn(() => null);
+ const NewCellComponent = vi.fn(() =>
);
rerender(
) {
+}: GridProps): ReactElement {
const cellProps = useMemoizedObject(cellPropsUnstable);
const CellComponent = useMemo(
() => memo(CellComponentProp, arePropsEqual),
diff --git a/lib/components/grid/types.ts b/lib/components/grid/types.ts
index f2d18643..1d0ca266 100644
--- a/lib/components/grid/types.ts
+++ b/lib/components/grid/types.ts
@@ -2,6 +2,7 @@ import type {
ComponentProps,
CSSProperties,
HTMLAttributes,
+ ReactElement,
ReactNode,
Ref
} from "react";
@@ -34,7 +35,7 @@ export type GridProps<
rowIndex: number;
style: CSSProperties;
} & CellProps
- ) => ReactNode;
+ ) => ReactElement;
/**
* Additional props to be passed to the cell-rendering component.
diff --git a/lib/components/list/List.test.tsx b/lib/components/list/List.test.tsx
index 9f8faf1b..ba3cf304 100644
--- a/lib/components/list/List.test.tsx
+++ b/lib/components/list/List.test.tsx
@@ -181,7 +181,7 @@ describe("List", () => {
/>
);
- const NewRowComponent = vi.fn(() => null);
+ const NewRowComponent = vi.fn(() => );
rerender(
) {
+}: ListProps): ReactElement {
const rowProps = useMemoizedObject(rowPropsUnstable);
const RowComponent = useMemo(
() => memo(RowComponentProp, arePropsEqual),
diff --git a/lib/components/list/types.ts b/lib/components/list/types.ts
index c47ae2e6..110e759d 100644
--- a/lib/components/list/types.ts
+++ b/lib/components/list/types.ts
@@ -2,6 +2,7 @@ import type {
ComponentProps,
CSSProperties,
HTMLAttributes,
+ ReactElement,
ReactNode,
Ref
} from "react";
@@ -98,7 +99,7 @@ export type ListProps<
index: number;
style: CSSProperties;
} & RowProps
- ) => ReactNode;
+ ) => ReactElement;
/**
* Number of items to be rendered in the list.
diff --git a/scripts/utils/getPropTypeText.ts b/scripts/utils/getPropTypeText.ts
index ad2c0860..51ce874e 100644
--- a/scripts/utils/getPropTypeText.ts
+++ b/scripts/utils/getPropTypeText.ts
@@ -5,6 +5,14 @@ export function getPropTypeText(prop: PropItem) {
if (!textToFormat && prop.type.name.includes(":")) {
// Edge case where some prop types aren't registered as containing raw TS
textToFormat = prop.type.name;
+
+ // List/Grid and rowComponent/cellComponent are annotated with a return type of ReactElement instead of ReactNode
+ // As a result of this change the generated docs are significantly less readable, so tidy them up here
+ // See github.com/bvaughn/react-window/issues/875
+ textToFormat = textToFormat.replace(
+ "ReactElement>",
+ "ReactNode"
+ );
}
if (!textToFormat) {