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

@@ -30,6 +30,23 @@ export interface MessageStoreEvents {
"message:deleted": [messageId: string];
}
// ── Row Interfaces ───────────────────────────────────────────────────
/** Database row shape for the messages table. */
interface MessageRow {
id: string;
fromId: string;
fromType: string;
toId: string;
toType: string;
content: string;
type: string;
read: number;
metadata: string | null;
createdAt: string;
updatedAt: string;
}
// ── Options Types ────────────────────────────────────────────────────
/** Options for MessageStore constructor */
@@ -95,7 +112,7 @@ export class MessageStore extends EventEmitter<MessageStoreEvents> {
/**
* Convert a database row to a Message object.
*/
private rowToMessage(row: any): Message {
private rowToMessage(row: MessageRow): Message {
return {
id: row.id,
fromId: row.fromId,
@@ -172,7 +189,7 @@ export class MessageStore extends EventEmitter<MessageStoreEvents> {
* @returns The message, or null if not found
*/
getMessage(id: string): Message | null {
const row = this.stmtGetById.get(id);
const row = this.stmtGetById.get(id) as unknown as MessageRow | undefined;
if (!row) return null;
return this.rowToMessage(row);
}
@@ -239,7 +256,7 @@ export class MessageStore extends EventEmitter<MessageStoreEvents> {
LIMIT ? OFFSET ?
`).all(...params, limit, offset);
return (rows as any[]).map((row) => this.rowToMessage(row));
return (rows as unknown as MessageRow[]).map((row) => this.rowToMessage(row));
}
/**
@@ -336,7 +353,7 @@ export class MessageStore extends EventEmitter<MessageStoreEvents> {
participantA.id, participantA.type,
);
return (rows as any[]).map((row) => this.rowToMessage(row));
return (rows as unknown as MessageRow[]).map((row) => this.rowToMessage(row));
}
/**
@@ -352,7 +369,7 @@ export class MessageStore extends EventEmitter<MessageStoreEvents> {
const unreadRow = this.stmtCountUnread.get(ownerId, ownerType) as { count: number } | undefined;
const unreadCount = unreadRow?.count ?? 0;
const lastRow = this.stmtGetLastMessage.get(ownerId, ownerType);
const lastRow = this.stmtGetLastMessage.get(ownerId, ownerType) as unknown as MessageRow | undefined;
const lastMessage = lastRow ? this.rowToMessage(lastRow) : undefined;
return {