fix: restore strict tsconfig flags and fix all violations#12
Merged
Conversation
PR #9 enabled type-aware linting in the gate but removed noUncheckedIndexedAccess, exactOptionalPropertyTypes, and noPropertyAccessFromIndexSignature instead of fixing the ~190 violations they flagged. This restores all three flags and fixes every violation, behavior-preserving except one real bug: resolveFocusTarget returned undefined (despite promising PlainDate) when the weeks grid was empty; it now falls back to focusedDate, with a regression test. Fix patterns: real narrowing or locally-obvious non-null assertions for indexed access; conditional spreads for optional props under exactOptionalPropertyTypes; readonly param for computeSelectionUpdate. No as-any, no ts-expect-error, no semantic fallbacks. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review feedback on the strict-flags fix: the indexed-access assertions were unwarranted. All ~97 added assertions are now real checks: - weeks-grid: iterate .entries() carrying the element; guards on the parallel-array reads - temporal-polyfill: malformed ISO strings now throw RangeError (matching real Temporal) instead of NaN-propagating; formatToParts reads collapse into named locals with one completeness check - grid-header: index prop is validated (genuinely reachable for a public prop) instead of asserted - tests: vitest/chai assert() narrowing on mock calls and grid lookups; median/p95 helpers take a length guard instead of per-index asserts No new assertions, no as-any, no expectation changes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
|
Replaced all ~97 non-null assertions from the original push with real narrowing checks (loop restructures via .entries(), named-local guards, vitest assert() in tests). One deliberate behavior change worth noting: the mini temporal-polyfill now throws RangeError on malformed ISO strings — matching real Temporal — where it previously NaN-propagated silently. Gate green: lint 0/0, 666+54 tests passing. |
Real narrowing checks stay in source files only; the assert() conversions in tests added noise without value. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
7f4f641 to
6c755e1
Compare
The destructure `const [weekStart, weekEnd] = weekDays` took the week's second day as its end, flipping the inactive early-exit and extendsAfter for any week longer than two days. Restore the last-element read while keeping the INACTIVE_RANGE_INFO refactor. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
306d426 to
73eb765
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Audit fix A (1 of 5). PR #9 wired type-aware linting into the gate (
vp lintnow runs the TypeScript checker) but made the pre-existing errors disappear by deletingnoUncheckedIndexedAccess,exactOptionalPropertyTypes, andnoPropertyAccessFromIndexSignaturefrom the root tsconfig. This PR restores all three flags and fixes the ~190 violations they surface, so the gate now enforces the strictness the codebase was written against.Real bug fixed
resolveFocusTarget(package/src/utils.ts) returnedundefined— despite promisingTemporal.PlainDate— when the weeks grid was empty. It now falls back tofocusedDate(its own non-optional parameter), with a regression test covering both polyfill variants. TDD: test written first, watched fail, then fixed.Fix patterns (behavior-preserving)
noUncheckedIndexedAccess: real narrowing where practical; non-null assertions only where the bounds invariant is locally obvious (loop-bounded parallel arrays, literal two-element tuples). Freely used in test files.exactOptionalPropertyTypes: conditional spreads (...(x !== undefined && { x })) at call sites; no shared/public type was widened exceptDayCellInstanceProps.columnIndex(declared and consumed in day-cell.tsx).computeSelectionUpdate'scommittedDatesparam is nowreadonly(it never mutates), andcomputePreviewRangemodels "no committed range" asundefinedinstead of casts.as any, no@ts-expect-error, no semantic fallback values inserted.Verification
vp run readyexits 0: format clean, lint (with type checking) 0 warnings / 0 errors, package 666/666 tests, website 54/54.🤖 Generated with Claude Code