mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 10:34:35 -07:00
Disallow redundant typecasts. (#15030)
This commit is contained in:
committed by
GitHub
parent
fcc3b2b5ec
commit
942bcfc61e
@@ -433,7 +433,7 @@ export async function handleAtCommand({
|
||||
const processedQueryParts: PartListUnion = [{ text: initialQueryText }];
|
||||
|
||||
const resourcePromises = resourceAttachments.map(async (resource) => {
|
||||
const uri = resource.uri!;
|
||||
const uri = resource.uri;
|
||||
const client = mcpClientManager?.getClient(resource.serverName);
|
||||
try {
|
||||
if (!client) {
|
||||
|
||||
@@ -26,9 +26,7 @@ import { MessageType } from '../types.js';
|
||||
vi.mock('./useKeypress.js');
|
||||
|
||||
vi.mock('@google/gemini-cli-core', async () => {
|
||||
const actualServerModule = (await vi.importActual(
|
||||
'@google/gemini-cli-core',
|
||||
)) as Record<string, unknown>;
|
||||
const actualServerModule = await vi.importActual('@google/gemini-cli-core');
|
||||
return {
|
||||
...actualServerModule,
|
||||
Config: vi.fn(),
|
||||
|
||||
@@ -24,7 +24,6 @@ import { useReactToolScheduler } from './useReactToolScheduler.js';
|
||||
import type {
|
||||
Config,
|
||||
EditorType,
|
||||
GeminiClient,
|
||||
AnyToolInvocation,
|
||||
} from '@google/gemini-cli-core';
|
||||
import {
|
||||
@@ -809,8 +808,8 @@ describe('useGeminiStream', () => {
|
||||
expect(client.addHistory).toHaveBeenCalledWith({
|
||||
role: 'user',
|
||||
parts: [
|
||||
...(cancelledToolCall1.response.responseParts as Part[]),
|
||||
...(cancelledToolCall2.response.responseParts as Part[]),
|
||||
...cancelledToolCall1.response.responseParts,
|
||||
...cancelledToolCall2.response.responseParts,
|
||||
],
|
||||
});
|
||||
|
||||
@@ -2074,7 +2073,7 @@ describe('useGeminiStream', () => {
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
useGeminiStream(
|
||||
mockConfig.getGeminiClient() as GeminiClient,
|
||||
mockConfig.getGeminiClient(),
|
||||
[],
|
||||
mockAddItem,
|
||||
mockConfig,
|
||||
|
||||
@@ -833,10 +833,7 @@ export const useGeminiStream = (
|
||||
);
|
||||
break;
|
||||
case ServerGeminiEventType.Finished:
|
||||
handleFinishedEvent(
|
||||
event as ServerGeminiFinishedEvent,
|
||||
userMessageTimestamp,
|
||||
);
|
||||
handleFinishedEvent(event, userMessageTimestamp);
|
||||
break;
|
||||
case ServerGeminiEventType.Citation:
|
||||
handleCitationEvent(event.value, userMessageTimestamp);
|
||||
|
||||
@@ -183,7 +183,7 @@ describe('useIncludeDirsTrust', () => {
|
||||
).props;
|
||||
expect(dialogProps.folders).toEqual(['/undefined']);
|
||||
expect(dialogProps.trustedDirs).toEqual(['/trusted']);
|
||||
expect(dialogProps.errors as string[]).toEqual([
|
||||
expect(dialogProps.errors).toEqual([
|
||||
`The following directories are explicitly untrusted and cannot be added to a trusted workspace:\n- /untrusted\nPlease use the permissions command to modify their trust level.`,
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -99,7 +99,7 @@ export function useReactToolScheduler(
|
||||
setToolCallsForDisplay((prevCalls) =>
|
||||
prevCalls.map((tc) => {
|
||||
if (tc.request.callId === toolCallId && tc.status === 'executing') {
|
||||
const executingTc = tc as TrackedExecutingToolCall;
|
||||
const executingTc = tc;
|
||||
return { ...executingTc, liveOutput: outputChunk };
|
||||
}
|
||||
return tc;
|
||||
@@ -137,7 +137,7 @@ export function useReactToolScheduler(
|
||||
...coreTc,
|
||||
responseSubmittedToGemini,
|
||||
liveOutput,
|
||||
pid: (coreTc as ExecutingToolCall).pid,
|
||||
pid: coreTc.pid,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
@@ -312,10 +312,9 @@ export function mapToDisplay(
|
||||
return {
|
||||
...baseDisplayProperties,
|
||||
status: mapCoreStatusToDisplayStatus(trackedCall.status),
|
||||
resultDisplay:
|
||||
(trackedCall as TrackedExecutingToolCall).liveOutput ?? undefined,
|
||||
resultDisplay: trackedCall.liveOutput ?? undefined,
|
||||
confirmationDetails: undefined,
|
||||
ptyId: (trackedCall as TrackedExecutingToolCall).pid,
|
||||
ptyId: trackedCall.pid,
|
||||
};
|
||||
case 'validating': // Fallthrough
|
||||
case 'scheduled':
|
||||
|
||||
@@ -106,7 +106,7 @@ const computeInitialIndex = (
|
||||
|
||||
if (initialKey !== undefined) {
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (items[i]!.key === initialKey && !items[i]!.disabled) {
|
||||
if (items[i].key === initialKey && !items[i].disabled) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@ function areBaseItemsEqual(
|
||||
if (a.length !== b.length) return false;
|
||||
|
||||
for (let i = 0; i < a.length; i++) {
|
||||
if (a[i]!.key !== b[i]!.key || a[i]!.disabled !== b[i]!.disabled) {
|
||||
if (a[i].key !== b[i].key || a[i].disabled !== b[i].disabled) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -283,7 +283,7 @@ export function useSelectionList<T>({
|
||||
let needsClear = false;
|
||||
|
||||
if (state.pendingHighlight && items[state.activeIndex]) {
|
||||
onHighlight?.(items[state.activeIndex]!.value);
|
||||
onHighlight?.(items[state.activeIndex].value);
|
||||
needsClear = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user