From fb24a2a7968b45cbf3d4ba99e1c7f2728dfbee27 Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Sun, 22 Sep 2024 21:27:41 -0400 Subject: [PATCH] Use satisfies for type safety --- src/ClaudeDev.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ClaudeDev.ts b/src/ClaudeDev.ts index 28ce829..57bddd3 100644 --- a/src/ClaudeDev.ts +++ b/src/ClaudeDev.ts @@ -937,7 +937,7 @@ export class ClaudeDev { tool: "editedExistingFile", path: this.getReadablePath(relPath), diff: this.createPrettyPatch(relPath, originalContent, newContent), - } as ClaudeSayTool) + } satisfies ClaudeSayTool) ) } else { userResponse = await this.ask( @@ -946,7 +946,7 @@ export class ClaudeDev { tool: "newFileCreated", path: this.getReadablePath(relPath), content: newContent, - } as ClaudeSayTool) + } satisfies ClaudeSayTool) ) } const { response, text, images } = userResponse @@ -1111,7 +1111,7 @@ export class ClaudeDev { tool: fileExists ? "editedExistingFile" : "newFileCreated", path: this.getReadablePath(relPath), diff: this.createPrettyPatch(relPath, normalizedNewContent, normalizedEditedContent), - } as ClaudeSayTool) + } satisfies ClaudeSayTool) ) return [ false, @@ -1220,7 +1220,7 @@ export class ClaudeDev { tool: "readFile", path: this.getReadablePath(relPath), content: absolutePath, - } as ClaudeSayTool) + } satisfies ClaudeSayTool) if (this.alwaysAllowReadOnly) { await this.say("tool", message) } else { @@ -1264,7 +1264,7 @@ export class ClaudeDev { tool: recursive ? "listFilesRecursive" : "listFilesTopLevel", path: this.getReadablePath(relDirPath), content: result, - } as ClaudeSayTool) + } satisfies ClaudeSayTool) if (this.alwaysAllowReadOnly) { await this.say("tool", message) } else { @@ -1368,7 +1368,7 @@ export class ClaudeDev { tool: "listCodeDefinitionNames", path: this.getReadablePath(relDirPath), content: result, - } as ClaudeSayTool) + } satisfies ClaudeSayTool) if (this.alwaysAllowReadOnly) { await this.say("tool", message) } else { @@ -1418,7 +1418,7 @@ export class ClaudeDev { regex: regex, filePattern: filePattern, content: results, - } as ClaudeSayTool) + } satisfies ClaudeSayTool) if (this.alwaysAllowReadOnly) { await this.say("tool", message)