mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-17 15:23:36 +01:00
Enable tsconfig noUncheckedIndexedAccess
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user