From db539545e3a76fe47599ffdea5252bd8b87e56c3 Mon Sep 17 00:00:00 2001 From: null Date: Fri, 10 Jul 2026 18:17:13 -0500 Subject: [PATCH] refactor(types): drop @ts-nocheck from the 9 smallest routes (Phase 6 starter) analytics, settings, tracker, about, calendarFeed, privacy, version, user, matches now fully type-checked by tsconfig.server.json. Fallout was 4 errors total: calendarFeed's res.set(object) -> per-header calls (+ the test mock now accepts both Express set() forms), and two error adapters gained parameter types. @ts-nocheck census: 38 -> 29 files; the B0 recon counter ratchets this down each cycle (QA-B0-04). Co-Authored-By: Claude Fable 5 --- routes/about.cts | 2 +- routes/analytics.cts | 2 +- routes/calendarFeed.cts | 10 ++++------ routes/matches.cts | 4 ++-- routes/privacy.cts | 2 +- routes/settings.cts | 2 +- routes/tracker.cts | 2 +- routes/user.cts | 4 ++-- routes/version.cts | 2 +- tests/calendarFeedService.test.js | 6 ++++-- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/routes/about.cts b/routes/about.cts index cdbd054..0d1e607 100644 --- a/routes/about.cts +++ b/routes/about.cts @@ -1,4 +1,4 @@ -// @ts-nocheck — route controller converted to .cts; handler req/res typed, full type-check deferred (thin glue over typed services). +// Fully type-checked (tsconfig.server.json); leading import type keeps Node type-stripping active. import type { Req, Res, Next } from '../types/http'; const express = require('express'); const router = express.Router(); diff --git a/routes/analytics.cts b/routes/analytics.cts index 075eb9d..72663ab 100644 --- a/routes/analytics.cts +++ b/routes/analytics.cts @@ -1,4 +1,4 @@ -// @ts-nocheck — route controller converted to .cts; handler req/res typed, full type-check deferred (thin glue over typed services). +// Fully type-checked (tsconfig.server.json); leading import type keeps Node type-stripping active. import type { Req, Res, Next } from '../types/http'; const express = require('express'); const router = express.Router(); diff --git a/routes/calendarFeed.cts b/routes/calendarFeed.cts index 4dc72f2..f6ffd1e 100644 --- a/routes/calendarFeed.cts +++ b/routes/calendarFeed.cts @@ -1,4 +1,4 @@ -// @ts-nocheck — route controller converted to .cts; handler req/res typed, full type-check deferred (thin glue over typed services). +// Fully type-checked (tsconfig.server.json); leading import type keeps Node type-stripping active. import type { Req, Res, Next } from '../types/http'; ('use strict'); @@ -25,11 +25,9 @@ router.get('/feed.ics', (req: Req, res: Res) => { markTokenUsed(tokenRow.id); res.status(200); - res.set({ - 'Content-Type': 'text/calendar; charset=utf-8', - 'Content-Disposition': 'inline; filename="bill-tracker.ics"', - 'Cache-Control': 'private, max-age=300', - }); + res.set('Content-Type', 'text/calendar; charset=utf-8'); + res.set('Content-Disposition', 'inline; filename="bill-tracker.ics"'); + res.set('Cache-Control', 'private, max-age=300'); return res.send(ics); }); diff --git a/routes/matches.cts b/routes/matches.cts index b92c42a..efc0711 100644 --- a/routes/matches.cts +++ b/routes/matches.cts @@ -1,4 +1,4 @@ -// @ts-nocheck — route controller converted to .cts; handler req/res typed, full type-check deferred (thin glue over typed services). +// Fully type-checked (tsconfig.server.json); leading import type keeps Node type-stripping active. import type { Req, Res, Next } from '../types/http'; const router = require('express').Router(); const { getDb } = require('../db/database.cts'); @@ -23,7 +23,7 @@ const { todayLocal } = require('../utils/dates.mts'); // 4xx service errors keep their message/code on the wire; anything else is // rethrown raw so the terminal handler masks + logs it as a 5xx. -function toMatchError(err) { +function toMatchError(err: any) { if (err.status && err.status < 500) { return new ApiError(err.code || 'MATCH_ERROR', err.message, err.status, { field: err.field }); } diff --git a/routes/privacy.cts b/routes/privacy.cts index caec7db..d749f09 100644 --- a/routes/privacy.cts +++ b/routes/privacy.cts @@ -1,4 +1,4 @@ -// @ts-nocheck — route controller converted to .cts; handler req/res typed, full type-check deferred (thin glue over typed services). +// Fully type-checked (tsconfig.server.json); leading import type keeps Node type-stripping active. import type { Req, Res, Next } from '../types/http'; const express = require('express'); const router = express.Router(); diff --git a/routes/settings.cts b/routes/settings.cts index b810174..0bfbf0c 100644 --- a/routes/settings.cts +++ b/routes/settings.cts @@ -1,4 +1,4 @@ -// @ts-nocheck — route controller converted to .cts; handler req/res typed, full type-check deferred (thin glue over typed services). +// Fully type-checked (tsconfig.server.json); leading import type keeps Node type-stripping active. import type { Req, Res, Next } from '../types/http'; ('use strict'); diff --git a/routes/tracker.cts b/routes/tracker.cts index 2f6a8d6..712a93e 100644 --- a/routes/tracker.cts +++ b/routes/tracker.cts @@ -1,4 +1,4 @@ -// @ts-nocheck — route controller converted to .cts; handler req/res typed, full type-check deferred (thin glue over typed services). +// Fully type-checked (tsconfig.server.json); leading import type keeps Node type-stripping active. import type { Req, Res, Next } from '../types/http'; const express = require('express'); const router = express.Router(); diff --git a/routes/user.cts b/routes/user.cts index 04f5aac..92752a9 100644 --- a/routes/user.cts +++ b/routes/user.cts @@ -1,4 +1,4 @@ -// @ts-nocheck — route controller converted to .cts; handler req/res typed, full type-check deferred (thin glue over typed services). +// Fully type-checked (tsconfig.server.json); leading import type keeps Node type-stripping active. import type { Req, Res, Next } from '../types/http'; ('use strict'); @@ -12,7 +12,7 @@ const { ApiError, ValidationError } = require('../utils/apiError.cts'); // 4xx service errors keep their message/code on the wire; anything else is // rethrown raw so the terminal handler masks + logs it as a 5xx. -function toUserOpError(err, fallbackCode) { +function toUserOpError(err: any, fallbackCode: string) { if (err.status && err.status < 500) { return new ApiError(err.code || fallbackCode, err.message, err.status); } diff --git a/routes/version.cts b/routes/version.cts index 864953e..34428c9 100644 --- a/routes/version.cts +++ b/routes/version.cts @@ -1,4 +1,4 @@ -// @ts-nocheck — route controller converted to .cts; handler req/res typed, full type-check deferred (thin glue over typed services). +// Fully type-checked (tsconfig.server.json); leading import type keeps Node type-stripping active. import type { Req, Res, Next } from '../types/http'; const express = require('express'); const router = express.Router(); diff --git a/tests/calendarFeedService.test.js b/tests/calendarFeedService.test.js index 09ab2a5..19c566e 100644 --- a/tests/calendarFeedService.test.js +++ b/tests/calendarFeedService.test.js @@ -77,8 +77,10 @@ function callFeedRoute(query) { headers['Content-Type'] = value; return this; }, - set(values) { - Object.assign(headers, values); + set(field, value) { + // Express supports both set(obj) and set(field, value) + if (typeof field === 'object') Object.assign(headers, field); + else headers[field] = value; return this; }, send(body) {