refactor: eliminate all catch(err: any) with proper unknown typing + type email transport
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 19m10s

- Replace all catch(err: any) with catch(err: unknown) across 8 source files
- Add errorMessage() and errorCode() helpers for safe error property access
- Type nodemailer transport config as SMTPTransport.Options (was any)
- Type health endpoint databaseStatus (was any)
- Type convert route margin param (was any)
- Change queryWithRetry params from any[] to unknown[]
- Update isTransientError to require Error instances (was accepting plain objects)
- 19 new TDD tests (error-type-safety.test.ts)
- Updated existing tests to use proper Error instances
- 598 tests total, all passing, zero type errors
This commit is contained in:
DocFast CEO 2026-03-09 11:10:58 +01:00
parent da049b77e3
commit 5a7ee79316
12 changed files with 221 additions and 98 deletions

View file

@ -172,7 +172,7 @@ templatesRouter.post("/:id/render", async (req: Request, res: Response) => {
res.setHeader("Content-Type", "application/pdf");
res.setHeader("Content-Disposition", `inline; filename="${filename}"`);
res.send(pdf);
} catch (err: any) {
} catch (err: unknown) {
logger.error({ err }, "Template render error");
res.status(500).json({ error: "Template rendering failed" });
}