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 <noreply@anthropic.com>
This commit is contained in:
null 2026-07-10 18:17:13 -05:00
parent a31a774f95
commit db539545e3
10 changed files with 18 additions and 18 deletions

View File

@ -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();

View File

@ -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();

View File

@ -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);
});

View File

@ -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 });
}

View File

@ -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();

View File

@ -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');

View File

@ -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();

View File

@ -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);
}

View File

@ -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();

View File

@ -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) {