From 8bce4a37e1f5c4cc6fabf314735db4cb55c0a8a3 Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Mon, 24 Feb 2025 08:29:34 -0800 Subject: [PATCH] Change TouchedViewDataAtPoint type in ReactNativeTypes to use supported by Flow tooling syntax (#32382) Summary: ## Summary The `flow-api-translator` from the `hermes` repo does not support flow type spreads. It is currently not able to digest the ReactNativeTypes file as it contains unsupported syntax. The simplest solution is to change the type of the `TouchedViewDataAtPoint` to equivalent, yet supported by the Flow tooling. In this case the intersection can be used as the `TouchedViewDataAtPoint` and `InspectorData` have no common property. ## How did you test this change? Run yarn flow native DiffTrain build for [e670e72fa076449e40172e20d17cc67c1c15419c](https://github.com/facebook/react/commit/e670e72fa076449e40172e20d17cc67c1c15419c) Reviewed By: rickhanlonii Differential Revision: D69661050 fbshipit-source-id: 1732bd9ac9c1af1e4c0b95758e92d9ccf3b807e6 --- .../Renderer/shims/ReactNativeTypes.js | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js b/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js index ff7b9cd0e48..a21b64c7672 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<> */ import type {ElementRef, ElementType, MixedElement} from 'react'; @@ -165,18 +165,19 @@ 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< + { + pointerY: number, + touchedViewTag?: number, + frame: $ReadOnly<{ + top: number, + left: number, + width: number, + height: number, + }>, + closestPublicInstance?: PublicInstance, + } & InspectorData, +>; export type RenderRootOptions = { onUncaughtError?: (