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:
@@ -143,25 +143,26 @@ async function runConfiguredCommand(
|
||||
bufferExceeded: false,
|
||||
timedOut: false,
|
||||
};
|
||||
} catch (error: any) {
|
||||
const code = error?.code;
|
||||
const status = typeof error?.status === "number" ? error.status : null;
|
||||
} catch (error) {
|
||||
const errObj = error as Record<string, unknown>;
|
||||
const code = errObj?.code;
|
||||
const status = typeof errObj?.status === "number" ? errObj.status : null;
|
||||
const exitCode = typeof code === "number" ? code : status;
|
||||
const message = String(error?.message ?? "");
|
||||
const message = String(errObj?.message ?? "");
|
||||
|
||||
return {
|
||||
stdout: error?.stdout?.toString?.() ?? "",
|
||||
stderr: error?.stderr?.toString?.() ?? "",
|
||||
stdout: typeof (errObj?.stdout as { toString?: unknown })?.toString === "function" ? String(errObj.stdout) : "",
|
||||
stderr: typeof (errObj?.stderr as { toString?: unknown })?.toString === "function" ? String(errObj.stderr) : "",
|
||||
exitCode,
|
||||
signal: (error?.signal as NodeJS.Signals | null | undefined) ?? null,
|
||||
signal: (errObj?.signal as NodeJS.Signals | null | undefined) ?? null,
|
||||
bufferExceeded:
|
||||
code === "ENOBUFS"
|
||||
|| code === "ERR_CHILD_PROCESS_STDIO_MAXBUFFER"
|
||||
|| message.includes("maxBuffer"),
|
||||
timedOut:
|
||||
code === "ETIMEDOUT"
|
||||
|| (error?.killed === true && (error?.signal === "SIGTERM" || message.includes("timed out"))),
|
||||
spawnError: code === "ENOENT" || code === "EACCES" ? error : undefined,
|
||||
|| (errObj?.killed === true && (errObj?.signal === "SIGTERM" || message.includes("timed out"))),
|
||||
spawnError: code === "ENOENT" || code === "EACCES" ? (error as Error) : undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,12 +273,13 @@ export class RoutineRunner {
|
||||
startedAt,
|
||||
completedAt: new Date().toISOString(),
|
||||
};
|
||||
} catch (err: any) {
|
||||
const stdout = err.stdout ?? "";
|
||||
const stderr = err.stderr ?? "";
|
||||
const error = err.killed
|
||||
} catch (err) {
|
||||
const errObj = err as Record<string, unknown>;
|
||||
const stdout = typeof errObj.stdout === "string" ? errObj.stdout : "";
|
||||
const stderr = typeof errObj.stderr === "string" ? errObj.stderr : "";
|
||||
const error = errObj.killed === true
|
||||
? `Command timed out after ${(timeoutMs ?? DEFAULT_TIMEOUT_MS) / 1000}s`
|
||||
: err.message ?? String(err);
|
||||
: (err instanceof Error ? err.message : null) ?? String(err);
|
||||
return {
|
||||
success: false,
|
||||
output: truncateOutput(stdout, stderr),
|
||||
@@ -398,7 +399,7 @@ export class RoutineRunner {
|
||||
stepIndex,
|
||||
success: false,
|
||||
output: "",
|
||||
error: `Unknown step type: "${(step as any).type}"`,
|
||||
error: `Unknown step type: "${String((step as unknown as Record<string, unknown>).type)}"`,
|
||||
startedAt,
|
||||
completedAt: new Date().toISOString(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user