From 7dad484aa7df99f6a43bbe72d8288662ac4c533c Mon Sep 17 00:00:00 2001 From: James Brunton Date: Mon, 15 Sep 2025 14:28:18 +0100 Subject: [PATCH] Improve type info on param hooks (#4438) # Description of Changes Changes it so that callers of `useBaseTool` know what actual type the parameters hook that they passed in returned, so they can actually make use of any extra methods that that params hook has. --- frontend/src/hooks/tools/shared/useBaseTool.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/hooks/tools/shared/useBaseTool.ts b/frontend/src/hooks/tools/shared/useBaseTool.ts index 723f95e44..996fae712 100644 --- a/frontend/src/hooks/tools/shared/useBaseTool.ts +++ b/frontend/src/hooks/tools/shared/useBaseTool.ts @@ -6,12 +6,12 @@ import { ToolOperationHook } from './useToolOperation'; import { BaseParametersHook } from './useBaseParameters'; import { StirlingFile } from '../../../types/fileContext'; -interface BaseToolReturn { +interface BaseToolReturn> { // File management selectedFiles: StirlingFile[]; // Tool-specific hooks - params: BaseParametersHook; + params: TParamsHook; operation: ToolOperationHook; // Endpoint validation @@ -33,13 +33,13 @@ interface BaseToolReturn { /** * Base tool hook for tool components. Manages standard behaviour for tools. */ -export function useBaseTool( +export function useBaseTool>( toolName: string, - useParams: () => BaseParametersHook, + useParams: () => TParamsHook, useOperation: () => ToolOperationHook, props: BaseToolProps, options?: { minFiles?: number } -): BaseToolReturn { +): BaseToolReturn { const minFiles = options?.minFiles ?? 1; const { onPreviewFile, onComplete, onError } = props;