Skip to content

Commit 380e851

Browse files
committed
test: enhance useCallback type definition in tests for better type safety
1 parent d7ff84b commit 380e851

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/client/src/components/editorComponents/WidgetQueryGeneratorForm/CommonControls/TableOrSpreadsheetDropdown/useTableOrSpreadsheet.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jest.mock("reselect", () => ({
4747
if (typeof resultFunc === "function") {
4848
return resultFunc();
4949
}
50+
5051
return jest.fn();
5152
}),
5253
}));
@@ -127,7 +128,7 @@ jest.mock("react", () => {
127128
updateConfig: jest.fn(),
128129
widgetId: "test-widget-id",
129130
}),
130-
useCallback: (fn: any) => fn,
131+
useCallback: <T extends (...args: unknown[]) => unknown>(fn: T) => fn,
131132
// useMemo will be mocked in each test
132133
useMemo: jest.fn(),
133134
};
@@ -158,6 +159,7 @@ describe("useTableOrSpreadsheet", () => {
158159
}));
159160

160161
const { result } = renderHook(() => useTableOrSpreadsheet());
162+
161163
expect(result.current).toBeTruthy();
162164
});
163165

0 commit comments

Comments
 (0)