fix: make tsc --noEmit pass cleanly#3
Closed
ruanbarroso wants to merge 2 commits into
Closed
Conversation
The `npm run type-check` script (tsc --noEmit) was failing while `next build` succeeded, because next.config sets typescript.ignoreBuildErrors: true and never type-checks. - Remove orphaned, unreferenced stale files that were never imported but broke tsc: KeysBrowser.backup.tsx (malformed JSX) and Dashboard.old.tsx (references to removed RedisStats fields). - types/redis.ts: add 'none' to RedisDataType (Redis TYPE returns it for missing keys); add instantaneousInputKbps/OutputKbps; allow clientRttP50/P95 to be null to match producers/consumers. - API routes: type ioredis call/config/slowlog results, annotate monitor callback params, break circular array inference in keys route, coalesce nullable connectionId. - Components: fix @/store import path in TreeView, pass undefined for null selectedKey, drop impossible 'cancelled' phase check, type the fractionalSecondDigits option (absent from ES2017 lib), drop invalid Chip size="large". - services/metrics.ts: guard possibly-undefined CPU stats. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adding 'none' to RedisDataType requires the getTypeColor lookup maps in KeysBrowser and TreeView to cover it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
npm run type-check(tsc --noEmit) was failing even thoughnext buildsucceeds. The build masks type errors becausenext.configsetstypescript.ignoreBuildErrors: true, sotscis the only thing that actually type-checks the project — and it was reporting 39 errors.The originally-reported errors came from
src/components/KeysBrowser.backup.tsx(malformed JSX), an orphaned file that isn't imported anywhere. But removing it revealed the rest of the project never type-checked cleanly either.Changes
Orphaned stale files removed (unreferenced — confirmed via grep, outside the build dependency graph):
src/components/KeysBrowser.backup.tsx— malformed JSX (the 4 originally-reported errors)src/components/Dashboard.old.tsx— referencedRedisStatsfields that no longer existsrc/types/redis.ts:'none'toRedisDataType— RedisTYPEreturnsnonefor missing keys, and the code already shoehorned it in via castsinstantaneousInputKbps/instantaneousOutputKbps(real Redis INFO fields, parsed in the metrics route)clientRttP50/clientRttP95to benumber | nullto match their producers and consumersAPI routes:
command: destructure command name soredis.call()gets a tuple, not a spreadconfig/slowlog: type theunknownresults of ioredisconfig()/slowlog()monitor: annotate themonitor()callback params (no-implicit-any)keys: explicit array type to break circular type inferencemetrics: coalesce nullableconnectionIdtoundefinedComponents:
TreeView: fix@/store/store→@/storeimport pathKeysBrowser: passundefinedfor anullselectedKey; drop an impossiblephase === 'cancelled'check (that phase never exists)Monitor: type thefractionalSecondDigitsoption (absent from the ES2017 lib types); drop invalidChip size="large"KeysBrowser/TreeView: addnoneto thegetTypeColorlookup mapssrc/services/metrics.ts: guard possibly-undefined CPU stat fields.Verification
npm run type-checknow exits 0 with no errors. Changes are type-level or behavior-preserving (the droppedChip size="large"was invalid and visuals come fromsx; the droppedcancelledcheck was always-true dead code).🤖 Generated with Claude Code