mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-06 11:21:15 -07:00
Disallow redundant typecasts. (#15030)
This commit is contained in:
committed by
GitHub
parent
fcc3b2b5ec
commit
942bcfc61e
@@ -17,7 +17,7 @@ vi.mock('./HistoryItemDisplay.js', async () => {
|
||||
const { Text } = await vi.importActual('ink');
|
||||
return {
|
||||
HistoryItemDisplay: ({ item }: { item: { content: string } }) =>
|
||||
React.createElement(Text as unknown as React.FC, null, item.content),
|
||||
React.createElement(Text as React.FC, null, item.content),
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -326,7 +326,7 @@ describe('SettingsDialog', () => {
|
||||
|
||||
// Navigate down
|
||||
act(() => {
|
||||
stdin.write(down as string);
|
||||
stdin.write(down);
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
@@ -335,7 +335,7 @@ describe('SettingsDialog', () => {
|
||||
|
||||
// Navigate up
|
||||
act(() => {
|
||||
stdin.write(up as string);
|
||||
stdin.write(up);
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
|
||||
@@ -144,7 +144,7 @@ export const ToolStatsDisplay: React.FC = () => {
|
||||
|
||||
{/* Tool Rows */}
|
||||
{activeTools.map(([name, stats]) => (
|
||||
<StatRow key={name} name={name} stats={stats as ToolCallStats} />
|
||||
<StatRow key={name} name={name} stats={stats} />
|
||||
))}
|
||||
|
||||
<Box height={1} />
|
||||
|
||||
@@ -119,7 +119,7 @@ export const TodoTray: React.FC = () => {
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
return tool.resultDisplay as TodoList;
|
||||
return tool.resultDisplay;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -11,8 +11,6 @@ import { DiffRenderer } from './DiffRenderer.js';
|
||||
import { RenderInline } from '../../utils/InlineMarkdownRenderer.js';
|
||||
import type {
|
||||
ToolCallConfirmationDetails,
|
||||
ToolExecuteConfirmationDetails,
|
||||
ToolMcpConfirmationDetails,
|
||||
Config,
|
||||
} from '@google/gemini-cli-core';
|
||||
import { IdeClient, ToolConfirmationOutcome } from '@google/gemini-cli-core';
|
||||
@@ -135,8 +133,7 @@ export const ToolConfirmationMessage: React.FC<
|
||||
});
|
||||
}
|
||||
} else if (confirmationDetails.type === 'exec') {
|
||||
const executionProps =
|
||||
confirmationDetails as ToolExecuteConfirmationDetails;
|
||||
const executionProps = confirmationDetails;
|
||||
|
||||
question = `Allow execution of: '${executionProps.rootCommand}'?`;
|
||||
options.push({
|
||||
@@ -187,7 +184,7 @@ export const ToolConfirmationMessage: React.FC<
|
||||
});
|
||||
} else {
|
||||
// mcp tool confirmation
|
||||
const mcpProps = confirmationDetails as ToolMcpConfirmationDetails;
|
||||
const mcpProps = confirmationDetails;
|
||||
question = `Allow execution of MCP tool "${mcpProps.toolName}" from server "${mcpProps.serverName}"?`;
|
||||
options.push({
|
||||
label: 'Yes, allow once',
|
||||
@@ -258,8 +255,7 @@ export const ToolConfirmationMessage: React.FC<
|
||||
);
|
||||
}
|
||||
} else if (confirmationDetails.type === 'exec') {
|
||||
const executionProps =
|
||||
confirmationDetails as ToolExecuteConfirmationDetails;
|
||||
const executionProps = confirmationDetails;
|
||||
let bodyContentHeight = availableBodyContentHeight();
|
||||
if (bodyContentHeight !== undefined) {
|
||||
bodyContentHeight -= 2; // Account for padding;
|
||||
@@ -312,7 +308,7 @@ export const ToolConfirmationMessage: React.FC<
|
||||
);
|
||||
} else {
|
||||
// mcp tool confirmation
|
||||
const mcpProps = confirmationDetails as ToolMcpConfirmationDetails;
|
||||
const mcpProps = confirmationDetails;
|
||||
|
||||
bodyContent = (
|
||||
<Box flexDirection="column">
|
||||
|
||||
@@ -59,7 +59,7 @@ function findLastIndex<T>(
|
||||
predicate: (value: T, index: number, obj: T[]) => unknown,
|
||||
): number {
|
||||
for (let i = array.length - 1; i >= 0; i--) {
|
||||
if (predicate(array[i]!, i, array)) {
|
||||
if (predicate(array[i], i, array)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -192,7 +192,7 @@ function VirtualizedList<T>(
|
||||
return { index: 0, offset: 0 };
|
||||
}
|
||||
|
||||
return { index, offset: scrollTop - offsets[index]! };
|
||||
return { index, offset: scrollTop - offsets[index] };
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user