From e670e72fa076449e40172e20d17cc67c1c15419c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Ma=C5=82ecki?= Date: Fri, 14 Feb 2025 15:10:37 +0100 Subject: [PATCH] Change TouchedViewDataAtPoint type in ReactNativeTypes to use supported by Flow tooling syntax (#32382) ## 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 --- .../src/ReactNativeTypes.js | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/packages/react-native-renderer/src/ReactNativeTypes.js b/packages/react-native-renderer/src/ReactNativeTypes.js index 8bce919d38..261e1f0b63 100644 --- a/packages/react-native-renderer/src/ReactNativeTypes.js +++ b/packages/react-native-renderer/src/ReactNativeTypes.js @@ -164,18 +164,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?: (