refactor: eliminate ~400 no-explicit-any warnings across the workspace

Parallel subagent pass: four typescript-pro agents on non-overlapping scopes.

Patterns applied:
- catch (err: any) { ... err.message ... } → catch (err) { ... getErrorMessage(err) ... }
  using the new @fusion/core helper. Bare catch {} where the error was unused.
- SQLite row types: defined typed XxxRow interfaces per table and cast
  .all()/.get() results via `as unknown as XxxRow[]` (the double cast is
  required because better-sqlite3 returns Record<string, SQLOutputValue>).
- rowToX(row: any) converters: typed argument with the matching row interface.
- Dynamic settings key writes: (settings as Record<string, unknown>)[key].
- React event handlers and setState callbacks: inferred types or concrete
  React.{Mouse,Change,Form}Event<...> where needed.
- pi-claude-cli: local PiMessage / PiContext duck types to avoid re-typing
  pi-ai concrete shapes; typed Claude stream event message fields.

72 files changed, ~400 anys eliminated. Typecheck passes across the workspace.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-23 18:57:31 -07:00
parent e3b6965620
commit 3fbb7c47cf
72 changed files with 1298 additions and 783 deletions

View File

@@ -42,6 +42,20 @@ import type { TaskStore } from "./store.js";
import { computeAccessState } from "./agent-permissions.js";
import { Database } from "./db.js";
/** Database row shape returned by SELECT on agentRatings. */
interface AgentRatingRow {
id: string;
agentId: string;
raterType: string;
raterId: string | null;
score: number;
category: string | null;
comment: string | null;
runId: string | null;
taskId: string | null;
createdAt: string;
}
/** Events emitted by AgentStore */
export interface AgentStoreEvents {
/** Emitted when an agent is created */
@@ -533,11 +547,11 @@ export class AgentStore extends EventEmitter {
};
}
private mapRatingRow(row: any): AgentRating {
private mapRatingRow(row: AgentRatingRow): AgentRating {
return {
id: row.id,
agentId: row.agentId,
raterType: row.raterType,
raterType: row.raterType as AgentRating["raterType"],
raterId: row.raterId ?? undefined,
score: row.score,
category: row.category ?? undefined,
@@ -604,7 +618,7 @@ export class AgentStore extends EventEmitter {
params.push(options.limit);
}
const rows = this.db.prepare(query).all(...params);
const rows = this.db.prepare(query).all(...params) as unknown as AgentRatingRow[];
return rows.map((row) => this.mapRatingRow(row));
}