mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-11 03:38:15 +00:00
fix: remove 'as any' type casts in retention feature
- Import and use RetentionSetting type instead of 'as any' in extension.ts - Use proper type narrowing for metadata parsing instead of 'as any'
This commit is contained in:
parent
fc04b9fc68
commit
8b30590665
2 changed files with 6 additions and 4 deletions
|
|
@ -44,7 +44,7 @@ import {
|
|||
} from "./activate"
|
||||
import { initializeI18n } from "./i18n"
|
||||
import { flushModels, initializeModelCacheRefresh, refreshModels } from "./api/providers/fetchers/modelCache"
|
||||
import { purgeOldTasks } from "./utils/task-history-retention"
|
||||
import { purgeOldTasks, RetentionSetting } from "./utils/task-history-retention"
|
||||
|
||||
/**
|
||||
* Built using https://github.com/microsoft/vscode-webview-ui-toolkit
|
||||
|
|
@ -175,7 +175,7 @@ export async function activate(context: vscode.ExtensionContext) {
|
|||
outputChannel.appendLine(`[Retention] Startup purge: setting=${retention}`)
|
||||
|
||||
const result = await purgeOldTasks(
|
||||
retention as any,
|
||||
retention as RetentionSetting,
|
||||
contextProxy.globalStorageUri.fsPath,
|
||||
(m) => {
|
||||
outputChannel.appendLine(m)
|
||||
|
|
|
|||
|
|
@ -153,8 +153,10 @@ export async function purgeOldTasks(
|
|||
// First try to get a timestamp from task_metadata.json (if present)
|
||||
try {
|
||||
const raw = await fs.readFile(metadataPath, "utf8")
|
||||
const meta = JSON.parse(raw)
|
||||
const maybeTs = Number((meta as any)?.ts)
|
||||
const meta: unknown = JSON.parse(raw)
|
||||
const maybeTs = Number(
|
||||
typeof meta === "object" && meta !== null && "ts" in meta ? (meta as { ts: unknown }).ts : undefined,
|
||||
)
|
||||
if (Number.isFinite(maybeTs)) {
|
||||
ts = maybeTs
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue