Enable tsconfig noUncheckedIndexedAccess

This commit is contained in:
Jamie
2026-03-12 16:24:01 -07:00
committed by GitHub
parent 34b0f9cd50
commit 1d45a52da7
311 changed files with 2146 additions and 1589 deletions

View File

@@ -510,6 +510,9 @@ export function processBodyRangesForSearchResult({
// To format the matches identified by FTS, we create synthetic BodyRanges to mix in
// with all the other formatting embedded in this message.
type HighlightMatch = RegExpExecArray & {
indices: Record<0 | 1, [number, number]>;
};
const highlightMatches = snippet.matchAll(
new RegExp(
`${SNIPPET_LEFT_PLACEHOLDER}(.*?)${SNIPPET_RIGHT_PLACEHOLDER}`,
@@ -520,9 +523,7 @@ export function processBodyRangesForSearchResult({
let placeholderCharsSkipped = 0;
for (const highlightMatch of highlightMatches) {
// TS < 5 does not have types for RegExpIndicesArray
const { indices } = highlightMatch as RegExpMatchArray & {
indices: Array<Array<number>>;
};
const { indices } = highlightMatch as HighlightMatch;
const [wholeMatchStartIdx] = indices[0];
const [matchedWordStartIdx, matchedWordEndIdx] = indices[1];
adjustedBodyRanges.push({