From 2cef7e74bdf90383211b179e5dc52f8bb28f9a12 Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Fri, 20 Nov 2026 11:32:22 -0800 Subject: [PATCH] Remove extra type arguments in calls Summary: X-link: https://github.com/react/metro/pull/2259 Flow will report extra type arguments on calls (`extra-type-arg`); until now it silently ignored them. These calls pass more type arguments than the callee declares. Remove the extra ones; Flow only ever used the leading ones, so typing is unchanged. Changelog: [Internal] Reviewed By: panagosg7 Differential Revision: D133555525 --- .../Libraries/Animated/components/AnimatedImage.js | 10 +++------- .../Libraries/Animated/components/AnimatedText.js | 10 +++------- .../Libraries/vendor/emitter/EventEmitter.js | 9 ++++----- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/packages/react-native/Libraries/Animated/components/AnimatedImage.js b/packages/react-native/Libraries/Animated/components/AnimatedImage.js index 66ad6dfac6ab..2bdbb00aebce 100644 --- a/packages/react-native/Libraries/Animated/components/AnimatedImage.js +++ b/packages/react-native/Libraries/Animated/components/AnimatedImage.js @@ -15,10 +15,6 @@ import Image from '../../Image/Image'; import createAnimatedComponent from '../createAnimatedComponent'; import * as React from 'react'; -export default createAnimatedComponent< - $FlowFixMe, - React.ElementRef, ->(Image as $FlowFixMe) as AnimatedComponentType< - ImageProps, - React.ElementRef, ->; +export default createAnimatedComponent<$FlowFixMe>( + Image as $FlowFixMe, +) as AnimatedComponentType>; diff --git a/packages/react-native/Libraries/Animated/components/AnimatedText.js b/packages/react-native/Libraries/Animated/components/AnimatedText.js index 7e67641db1fa..1db116355022 100644 --- a/packages/react-native/Libraries/Animated/components/AnimatedText.js +++ b/packages/react-native/Libraries/Animated/components/AnimatedText.js @@ -14,10 +14,6 @@ import Text, {type TextProps} from '../../Text/Text'; import createAnimatedComponent from '../createAnimatedComponent'; import * as React from 'react'; -export default createAnimatedComponent< - $FlowFixMe, - React.ElementRef, ->(Text as $FlowFixMe) as AnimatedComponentType< - TextProps, - React.ElementRef, ->; +export default createAnimatedComponent<$FlowFixMe>( + Text as $FlowFixMe, +) as AnimatedComponentType>; diff --git a/packages/react-native/Libraries/vendor/emitter/EventEmitter.js b/packages/react-native/Libraries/vendor/emitter/EventEmitter.js index 7fcfb0b43d04..91d82d463c05 100644 --- a/packages/react-native/Libraries/vendor/emitter/EventEmitter.js +++ b/packages/react-native/Libraries/vendor/emitter/EventEmitter.js @@ -101,11 +101,10 @@ export default class EventEmitter< 'EventEmitter.addListener(...): 2nd argument must be a function.', ); } - const registrations = allocate< - TEventToArgsMap, - keyof TEventToArgsMap, - TEventToArgsMap[TEvent], - >(this.#registry, eventType); + const registrations = allocate( + this.#registry, + eventType, + ); const registration: Registration = { context, listener,