From 70c4523d7bfd3094c8bb0079297c37133ad6eb3a Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Sun, 1 Nov 2026 07:58:46 -0800 Subject: [PATCH] Type the LogBox URL matcher's `exec` result as `RegExpExecArray` Summary: `LogBoxMessage` stores `regex.exec(...)` results in a local annotated as `RegExp$matchResult`, Flow's alias for `RegExpMatchArray` (the result type of `String#match`). Annotate it with `RegExpExecArray`, the type `exec` returns. That stays correct once `RegExpMatchArray`'s `index` and `input` become optional, as in TypeScript's library. Nothing changes at runtime. Changelog: [Internal] Differential Revision: D128877320 --- packages/react-native/Libraries/LogBox/UI/LogBoxMessage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxMessage.js b/packages/react-native/Libraries/LogBox/UI/LogBoxMessage.js index 626428a99bbe..4b58e335dea5 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxMessage.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxMessage.js @@ -25,7 +25,7 @@ function getLinkRanges(string: string): ReadonlyArray { const regex = /https?:\/\/[^\s$.?#].[^\s]*/gi; const matches = []; - let regexResult: RegExp$matchResult | null; + let regexResult: RegExpExecArray | null; while ((regexResult = regex.exec(string)) !== null) { if (regexResult != null) { matches.push({