Skip to content

Commit 96a8af2

Browse files
committed
fix: resolve TypeScript errors in clean_ws.ts
1 parent c2d6a5a commit 96a8af2

4 files changed

Lines changed: 15 additions & 9 deletions

File tree

src/mcp/tools/ui-testing/type_text.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ export async function type_textLogic(
4141
): Promise<ToolResponse> {
4242
const toolName = 'type_text';
4343
const simUuidValidation = validateRequiredParam('simulatorUuid', params.simulatorUuid);
44-
if (!simUuidValidation.isValid) return simUuidValidation.errorResponse;
44+
if (!simUuidValidation.isValid) return simUuidValidation.errorResponse!;
4545
const textValidation = validateRequiredParam('text', params.text);
46-
if (!textValidation.isValid) return textValidation.errorResponse;
46+
if (!textValidation.isValid) return textValidation.errorResponse!;
4747

4848
const { simulatorUuid, text } = params;
4949
const commandArgs = ['type', text];
@@ -54,7 +54,13 @@ export async function type_textLogic(
5454
);
5555

5656
try {
57-
await executeAxeCommand(commandArgs, simulatorUuid as string, 'type', executor, axeHelpers);
57+
await executeAxeCommand(
58+
commandArgs as string[],
59+
simulatorUuid as string,
60+
'type',
61+
executor,
62+
axeHelpers,
63+
);
5864
log('info', `${LOG_PREFIX}/${toolName}: Success for ${simulatorUuid}`);
5965
return createTextResponse('Text typing simulated successfully.');
6066
} catch (error) {
@@ -91,7 +97,7 @@ export default {
9197
text: z.string().min(1, 'Text cannot be empty'),
9298
},
9399
async handler(args: Record<string, unknown>): Promise<ToolResponse> {
94-
return type_textLogic(args, getDefaultCommandExecutor());
100+
return type_textLogic(args as unknown as TypeTextParams, getDefaultCommandExecutor());
95101
},
96102
};
97103

@@ -141,7 +147,7 @@ async function executeAxeCommand(
141147
);
142148
}
143149

144-
return result.output.trim();
150+
return createTextResponse(result.output.trim());
145151
} catch (error) {
146152
if (error instanceof Error) {
147153
if (error instanceof AxeError) {

src/mcp/tools/utilities/clean_proj.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export async function clean_projLogic(
4242

4343
const projectPathValidation = validateRequiredParam('projectPath', validated.projectPath);
4444
if (!projectPathValidation.isValid) {
45-
return projectPathValidation.errorResponse;
45+
return projectPathValidation.errorResponse!;
4646
}
4747

4848
log('info', 'Starting xcodebuild clean request');

src/mcp/tools/utilities/clean_ws.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export async function clean_wsLogic(
3838

3939
const workspacePathValidation = validateRequiredParam('workspacePath', validated.workspacePath);
4040
if (!workspacePathValidation.isValid) {
41-
return workspacePathValidation.errorResponse;
41+
return workspacePathValidation.errorResponse!;
4242
}
4343

4444
log('info', 'Starting xcodebuild clean request (internal)');

src/utils/test-common.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { XcodePlatform } from './xcode.js';
2222
import { executeXcodeBuildCommand } from './build-utils.js';
2323
import { createTextResponse, consolidateContentForClaudeCode } from './validation.js';
2424
import { ToolResponse } from '../types/common.js';
25-
import { CommandExecutor } from './command.js';
25+
import { CommandExecutor, getDefaultCommandExecutor } from './command.js';
2626

2727
/**
2828
* Type definition for test summary structure from xcresulttool
@@ -189,7 +189,7 @@ export async function handleTestLogic(
189189
},
190190
params.preferXcodebuild,
191191
'test',
192-
executor,
192+
executor || getDefaultCommandExecutor(),
193193
);
194194

195195
// Parse xcresult bundle if it exists, regardless of whether tests passed or failed

0 commit comments

Comments
 (0)