From 178febd0aa2c10dd3de4e53185fa12c7eb931ccf Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Wed, 9 Apr 2025 17:38:01 -0700 Subject: [PATCH] Replace $Diff with Omit in react-native (#50603) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50603 Changelog: [Internal] Reviewed By: gkz Differential Revision: D72740500 fbshipit-source-id: 829a51dfbdb597fec8b3cca29364a67158a8dd2a --- .../TextInput/AndroidTextInputNativeComponent.js | 2 +- .../Libraries/Components/TextInput/TextInput.flow.js | 2 +- .../Libraries/Components/Touchable/TouchableBounce.js | 2 +- .../Components/Touchable/TouchableHighlight.js | 2 +- packages/react-native/Libraries/Image/ImageProps.js | 2 +- .../__tests__/__snapshots__/public-api-test.js.snap | 10 +++++----- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js b/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js index 566ac157624..734b37d3dc3 100644 --- a/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +++ b/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js @@ -70,7 +70,7 @@ export type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline'; export type NativeProps = $ReadOnly<{ // This allows us to inherit everything from ViewProps except for style (see below) // This must be commented for Fabric codegen to work. - ...$Diff>, + ...Omit, /** * Android props after this diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js index 5fecbfdb292..9e3eac2078d 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js @@ -1008,7 +1008,7 @@ type TextInputBaseProps = $ReadOnly<{ }>; export type TextInputProps = $ReadOnly<{ - ...$Diff>, + ...Omit, ...TextInputIOSProps, ...TextInputAndroidProps, ...TextInputBaseProps, diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js b/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js index 40d6db22047..776076101bf 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js @@ -225,5 +225,5 @@ export default (React.forwardRef((props, hostRef: React.RefSetter) => ( )): component( ref: React.RefSetter, - ...props: $ReadOnly<$Diff> + ...props: $ReadOnly> )); diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js index 87cb8e5e546..a5abfba39cb 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js @@ -407,7 +407,7 @@ class TouchableHighlightImpl extends React.Component< const TouchableHighlight: component( ref?: React.RefSetter>, - ...props: $ReadOnly<$Diff> + ...props: $ReadOnly> ) = React.forwardRef((props, hostRef) => ( )); diff --git a/packages/react-native/Libraries/Image/ImageProps.js b/packages/react-native/Libraries/Image/ImageProps.js index 74f11e4e2bb..26c65d03f46 100644 --- a/packages/react-native/Libraries/Image/ImageProps.js +++ b/packages/react-native/Libraries/Image/ImageProps.js @@ -129,7 +129,7 @@ export type ImagePropsAndroid = $ReadOnly<{ }>; export type ImagePropsBase = $ReadOnly<{ - ...$Diff>, + ...Omit, /** * When true, indicates the image is an accessibility element. * diff --git a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap index ffe63c20556..5b79397c8e4 100644 --- a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap +++ b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap @@ -2413,7 +2413,7 @@ export type ReturnKeyType = | \\"yahoo\\"; export type SubmitBehavior = \\"submit\\" | \\"blurAndSubmit\\" | \\"newline\\"; export type NativeProps = $ReadOnly<{ - ...$Diff>, + ...Omit, autoComplete?: WithDefault< | \\"birthdate-day\\" | \\"birthdate-full\\" @@ -2955,7 +2955,7 @@ type TextInputBaseProps = $ReadOnly<{ value?: ?Stringish, }>; export type TextInputProps = $ReadOnly<{ - ...$Diff>, + ...Omit, ...TextInputIOSProps, ...TextInputAndroidProps, ...TextInputBaseProps, @@ -3240,7 +3240,7 @@ exports[`public API should not change unintentionally Libraries/Components/Touch }>; declare export default component( ref: React.RefSetter, - ...props: $ReadOnly<$Diff> + ...props: $ReadOnly> ); " `; @@ -3273,7 +3273,7 @@ export type TouchableHighlightProps = $ReadOnly<{ }>; declare const TouchableHighlight: component( ref?: React.RefSetter>, - ...props: $ReadOnly<$Diff> + ...props: $ReadOnly> ); declare export default typeof TouchableHighlight; " @@ -4323,7 +4323,7 @@ export type ImagePropsAndroid = $ReadOnly<{ resizeMultiplier?: ?number, }>; export type ImagePropsBase = $ReadOnly<{ - ...$Diff>, + ...Omit, accessible?: ?boolean, internal_analyticTag?: ?string, accessibilityLabel?: ?Stringish,