Enable noUncheckedIndexedAccess with ArrayUtils.assertGet and StringUtils.assertGet#408
Merged
Conversation
Adds oUncheckedIndexedAccess: true to tsconfig.json and wraps all indexed array/string accesses with Assert.asDefined() to satisfy the stricter type checking. This provides runtime safety for all array index accesses that were previously unchecked. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
971c939 to
7f1ed0f
Compare
…sertGet Adds noUncheckedIndexedAccess: true to tsconfig.json and wraps all indexed array accesses with ArrayUtils.assertGet() to satisfy the stricter type checking. This provides runtime safety for all array index accesses that were previously unchecked. Updates ArrayUtils.assertGet to include a default error message and details (index + collection length) for better diagnosability. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
7f1ed0f to
cb93b74
Compare
When lexing '..' at end of line, chr3 at positionStart+2 may not exist. Use optional indexing instead of StringUtils.assertGet since the character may legitimately be absent (DotDot vs Ellipsis lookahead). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mattmasson
approved these changes
Jun 8, 2026
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
Enables
noUncheckedIndexedAccess: truein tsconfig.json. All indexed array and string accesses are now explicitly checked at compile time, with runtime safety provided by dedicated assert helpers.Changes
noUncheckedIndexedAccess: trueArrayUtils.assertGet(arr, i)orStringUtils.assertGet(str, i)Assert.asDefinedcalls and migrated array-indexed ones to the new helpersRationale
noUncheckedIndexedAccessforces the compiler to treat everyarr[i]asT | undefined, catching potential out-of-bounds bugs at compile time. The dedicatedassertGethelpers provide:InvariantErrorif the index is out of bounds!orAssert.asDefined