Summary
tsconfig.check.json (added in #170, closing #157) covers src/**/* and bench/**/*, matching #157's proposal exactly except for one thing: #157 also proposed tests/**/*, which was left out because widening to it surfaces 32 pre-existing type errors that predate #170 entirely — they were already there, just never checked, for the same reason #157 existed: tsconfig.json never looked at anything outside src/.
This issue tracks fixing those 32 and then widening tsconfig.check.json's include to add tests/**/* (with tests/vendor/** excluded, since that's the third-party oracle, never ours to fix).
Reproduce
cat > /tmp/tsconfig.tests-check.json <<'JSON'
{
"extends": "./tsconfig.json",
"include": ["src/**/*", "bench/**/*", "tests/**/*"],
"exclude": ["tests/vendor/**"]
}
JSON
npx tsc --noEmit -p /tmp/tsconfig.tests-check.json
The 32 errors, by file
| file |
count |
tests/parity/linalg.test.ts |
13 |
tests/parity/matmath.test.ts |
10 |
tests/parity/motion_estimator.test.ts |
3 |
tests/reference/known-values.test.ts |
2 |
tests/reference/imgproc.test.ts |
2 |
tests/reference/reference-impl.ts |
1 |
tests/properties/edge-cases.test.ts |
1 |
Two repeating patterns, not 32 separate bugs
23 of 32 are matrix_t passed where a typed-array-shaped structural type is expected ({ data: Float32Array<ArrayBufferLike> }), in linalg.test.ts and matmath.test.ts. matrix_t.data is typed as the TypedArray union (Uint8Array | Int32Array | Float32Array | Float64Array), so TS can't narrow it to the specific typed array a helper signature demands — even though every call site is correct at runtime. Likely fixable by typing the affected test helpers against matrix_t/IMatrix_T directly instead of an ad hoc structural type, rather than touching src/.
5 of 32 are plain { x: number; y: number } object literals passed where point_t[] is expected, in motion_estimator.test.ts and known-values.test.ts. Same shape as the type error #157 itself found and the fix in #160's motion_estimator.bench.ts (point_t's constructor leaves fields unset by design, so a literal doesn't satisfy the interface) — these test files predate that fix and use the shortcut it warned against.
4 remaining are one-offs (Int32Array | Float32Array union narrowing in reference-impl.ts, number[] mismatches in imgproc.test.ts / edge-cases.test.ts) — worth a look individually, not part of either pattern above.
Why this matters
None of these are found by npm test (tests/** runs fine at runtime — vitest doesn't type-check) or by tsc -p tsconfig.json (scope is src/ only). They've been invisible for as long as the test suite has existed. #157 exists specifically because that invisibility let a real bug survive several PRs in bench/; the same gap exists in tests/ right now, just not yet triggered by anything as concrete.
Acceptance criteria
Related
Summary
tsconfig.check.json(added in #170, closing #157) coverssrc/**/*andbench/**/*, matching #157's proposal exactly except for one thing: #157 also proposedtests/**/*, which was left out because widening to it surfaces 32 pre-existing type errors that predate #170 entirely — they were already there, just never checked, for the same reason #157 existed:tsconfig.jsonnever looked at anything outsidesrc/.This issue tracks fixing those 32 and then widening
tsconfig.check.json'sincludeto addtests/**/*(withtests/vendor/**excluded, since that's the third-party oracle, never ours to fix).Reproduce
The 32 errors, by file
tests/parity/linalg.test.tstests/parity/matmath.test.tstests/parity/motion_estimator.test.tstests/reference/known-values.test.tstests/reference/imgproc.test.tstests/reference/reference-impl.tstests/properties/edge-cases.test.tsTwo repeating patterns, not 32 separate bugs
23 of 32 are
matrix_tpassed where a typed-array-shaped structural type is expected ({ data: Float32Array<ArrayBufferLike> }), inlinalg.test.tsandmatmath.test.ts.matrix_t.datais typed as theTypedArrayunion (Uint8Array | Int32Array | Float32Array | Float64Array), so TS can't narrow it to the specific typed array a helper signature demands — even though every call site is correct at runtime. Likely fixable by typing the affected test helpers againstmatrix_t/IMatrix_Tdirectly instead of an ad hoc structural type, rather than touchingsrc/.5 of 32 are plain
{ x: number; y: number }object literals passed wherepoint_t[]is expected, inmotion_estimator.test.tsandknown-values.test.ts. Same shape as the type error #157 itself found and the fix in #160'smotion_estimator.bench.ts(point_t's constructor leaves fields unset by design, so a literal doesn't satisfy the interface) — these test files predate that fix and use the shortcut it warned against.4 remaining are one-offs (
Int32Array | Float32Arrayunion narrowing inreference-impl.ts,number[]mismatches inimgproc.test.ts/edge-cases.test.ts) — worth a look individually, not part of either pattern above.Why this matters
None of these are found by
npm test(tests/**runs fine at runtime — vitest doesn't type-check) or bytsc -p tsconfig.json(scope issrc/only). They've been invisible for as long as the test suite has existed. #157 exists specifically because that invisibility let a real bug survive several PRs inbench/; the same gap exists intests/right now, just not yet triggered by anything as concrete.Acceptance criteria
src/behavior change (these are type-level fixes; the tests already pass at runtime).tsconfig.check.json'sincludewidened to["src/**/*", "bench/**/*", "tests/**/*"]withtests/vendor/**excluded.npm run typecheck(used byCI.yml) stays green with the wider scope.npm teststill green — confirms no behavior changed, only types.Related
bench/, deferredtests/here)point_tconstruction shortcut this echoes: feat(bench): add motion_estimator throughput benchmarks #160 (motion_estimator.bench.ts)