fix(lint): TS2345 noUncheckedIndexedAccess in standing-by-detector parseArgs#3015
Merged
Merged
Conversation
…rseArgs argv[i] inside a bounds-checked loop (i < argv.length) is always defined; add ! to narrow string|undefined to string so KNOWN_FLAGS.has() and Set-typed methods accept it. Same fix pattern as PR #3013. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR applies a focused TypeScript strictness fix in the Standing-by detector argument parser, matching the previously applied sibling fix for missed-substrate-detector.ts.
Changes:
- Adds a non-null assertion to
argv[i]inside a loop guarded byi < argv.length. - Documents why the assertion is safe under
noUncheckedIndexedAccess.
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
argv[i]inside theparseArgsloop is typedstring | undefinedundernoUncheckedIndexedAccessKNOWN_FLAGS.has(arg)fails becauseSet<string>.has()doesn't acceptundefinedi < argv.lengthguaranteesargv[i]is always defined — add!to narrowRoot cause
PR #3011 (B-0440.2) was squash-merged while the
lint (tsc tools)non-required check was still failing. That check fired on the entire codebase and caughtstanding-by-detector.ts. Since the check is non-required it didn't block merge, but the bug landed on main.PR #3013 applied the same fix pattern to
missed-substrate-detector.ts. This PR applies it tostanding-by-detector.ts.Test plan
bun --bun tsc --noEmit -p tsconfig.json— passes clean (verified locally)lint (tsc tools)passes🤖 Generated with Claude Code