From 4594b664e3e23a8426aab93e4a5959524dd0d2a6 Mon Sep 17 00:00:00 2001 From: Antiheld86 <4201585+Antiheld86@users.noreply.github.com> Date: Wed, 2 Sep 2026 21:26:10 +0000 Subject: [PATCH] Type the empty-input cases so tsc accepts the loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "neither series" test walks three inputs in one array literal. Inferred from the literals alone, the bare `{}` widens to `{ HRV_RMSSD?: undefined }`, and TypeScript rejects that against `pickHrvSummary`'s `Record | undefined` — an optional-undefined property is not assignable to the index signature. Vitest never typechecks, so the suite ran green while `tsc --noEmit` failed. Annotating the array pins the parameter type at the declaration and leaves all three cases exactly as they were. --- src/app/__tests__/dashboard-hrv-rmssd-fallback.test.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/app/__tests__/dashboard-hrv-rmssd-fallback.test.ts b/src/app/__tests__/dashboard-hrv-rmssd-fallback.test.ts index f9be40f77..99b2d519b 100644 --- a/src/app/__tests__/dashboard-hrv-rmssd-fallback.test.ts +++ b/src/app/__tests__/dashboard-hrv-rmssd-fallback.test.ts @@ -91,7 +91,14 @@ describe("pickHrvSummary", () => { // The tile is hidden either way; reporting the fallback type here would // make an account with no HRV at all look like a ring user to the label // and the freshness lookup. - for (const input of [undefined, {}, { HRV_RMSSD: summary(0, 0) }]) { + // Annotated: inferred from the literals alone, `{}` widens to + // `{ HRV_RMSSD?: undefined }`, which the index signature rejects. + const inputs: (Record | undefined)[] = [ + undefined, + {}, + { HRV_RMSSD: summary(0, 0) }, + ]; + for (const input of inputs) { const picked = pickHrvSummary(input); expect((picked.summary?.count ?? 0) > 0).toBe(false); expect(picked.type).toBe("HEART_RATE_VARIABILITY");