From b8959079643dd6e521c842ec28f3116da12ce6ec Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Fri, 4 Dec 2026 09:00:39 -0800 Subject: [PATCH] Write TouchedViewDataAtPoint as one object type (#38544) Summary: ## Summary `TouchedViewDataAtPoint` intersects two exact object types that have different properties: `{pointerY, touchedViewTag?, frame, closestPublicInstance?} & InspectorData`. No object is an instance of both, so the intersection can't be satisfied, and Flow's `experimental.normalize_intersections` option reports it (`invalid-exact`: property `frame` is missing in exact object `InspectorData`). This writes the type as one object that spreads `InspectorData`, with the same properties. Type-only change. ## How did you test this change? - Flow 0.317.0 on the generated `fabric` config (what `yarn flow fabric` runs): 0 errors before and after. - `prettier --check` and `eslint` on the file: clean. - The same change in React Native's copy (`packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js`), checked with Flow 0.343: no new errors or warnings, and with `experimental.normalize_intersections=true` the `invalid-exact` error is gone. DiffTrain build for [65cb72f3257a847b44b8f318f9d81b275681f294](https://github.com/react/react/commit/65cb72f3257a847b44b8f318f9d81b275681f294) Reviewed By: panagosg7 Differential Revision: D136068580 --- .../Renderer/shims/ReactNativeTypes.js | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js b/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js index 95abfe4192e..405f181d983 100644 --- a/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js +++ b/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js @@ -7,7 +7,7 @@ * @noformat * @nolint * @flow strict - * @generated SignedSource<> + * @generated SignedSource<<32401a8b5121a0972a11d32474e47418>> */ import type { @@ -103,19 +103,18 @@ export type InspectorData = Readonly<{ componentStack: string, }>; -export type TouchedViewDataAtPoint = Readonly< - { - pointerY: number, - touchedViewTag?: number, - frame: Readonly<{ - top: number, - left: number, - width: number, - height: number, - }>, - closestPublicInstance?: PublicInstance, - } & InspectorData, ->; +export type TouchedViewDataAtPoint = Readonly<{ + ...InspectorData, + pointerY: number, + touchedViewTag?: number, + frame: Readonly<{ + top: number, + left: number, + width: number, + height: number, + }>, + closestPublicInstance?: PublicInstance, +}>; export type RenderRootOptions = { onUncaughtError?: (