From 9bf7591b2bc546c3e9c3681bbf41eaedb460c31e Mon Sep 17 00:00:00 2001 From: Andrei Date: Wed, 29 Jul 2026 17:09:15 +0300 Subject: [PATCH] fix: type strictness: enable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit type strictness: enable noImplicitReturns+noFallthroughCasesInSwitch in evals and fix the fallout [loop-infinity-300pr] REPO: https://github.com/hasna/evals WHAT TO CHANGE tsconfig.json has "strict": true but neither "noImplicitReturns" nor "noFallthroughCasesInSwitch". Both catch real control-flow bugs: a code path that falls off the end of a function returning undefined, and a switch case that falls through unintentionally. Turn both on in compilerOptions and fix the fallout. DONE LOOKS LIKE - noImplicitReturns+noFallthroughCasesInSwitch enabled in tsconfig.json compilerOptions (all of the named flags, if more than one). - Fix each diagnostic by making the control flow explicit — add the missing return, add the missing break/return in the switch case, or make the function's return type include undefined if that is genuinely the contract. Do not add @ts-expect-error. - A deliberate switch fallthrough is legitimate; keep it and add the // falls through comment TypeScript recognises, rather than restructuring working code. - If the fallout is larger than roughly 60 diagnostics, land the smallest coherent slice, leave the flags off in the committed tsconfig, and state the remaining count in the PR body. - Behaviour unchanged. This is a type-safety change, not a refactor: no renamed exports, no changed signatures beyond what the flag forces, no reorganised files. VERIFY - `bun install && bun run typecheck` passes with the flag(s) on (or `bunx tsc --noEmit -p tsconfig.json` if the repo has no typecheck script — and if so, add one). - `bun test` passes, unchanged. EVIDENCE tsconfig.json compilerOptions read from GitHub HEAD on 2026-07-29 via the GitHub contents API — not from a stale local checkout. If the flag has since been enabled upstream, close this task as already-done with a one-line comment rather than opening an empty PR. PROCESS: work in a branch off the default branch, one focused change, conventional commit, open a PR. Do not bundle unrelated cleanups. If the repo has a CHANGELOG, add an entry. X-Factory-Run: run_0209db82f7fd X-Factory-Task: 69d1c44f-99dc-4a73-b22d-73b88343285c --- CHANGELOG.md | 5 +++++ tsconfig.json | 2 ++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 287eae7..eacc8f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed +- Enabled TypeScript checks for implicit returns and switch fallthrough. + ## [0.2.0] - 2026-07-27 ### Removed diff --git a/tsconfig.json b/tsconfig.json index 8207828..ec7cf4a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,6 +5,8 @@ "moduleResolution": "bundler", "lib": ["ESNext"], "strict": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, "noUncheckedIndexedAccess": true, "noUnusedLocals": true, "noUnusedParameters": true,