diff --git a/packages/react-native/Libraries/Animated/AnimatedWeb.js b/packages/react-native/Libraries/Animated/AnimatedWeb.js index e23a04587a7..167dafa6fe9 100644 --- a/packages/react-native/Libraries/Animated/AnimatedWeb.js +++ b/packages/react-native/Libraries/Animated/AnimatedWeb.js @@ -10,17 +10,35 @@ 'use strict'; +import type {AnimatedComponentType} from './createAnimatedComponent'; + import AnimatedImplementation from './AnimatedImplementation'; +import React from 'react'; export default { ...AnimatedImplementation, - /* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive - * types. Plain intrinsic components can't be typed like this */ - div: (AnimatedImplementation.createAnimatedComponent('div'): $FlowFixMe), - /* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive - * types. Plain intrinsic components can't be typed like this */ - span: (AnimatedImplementation.createAnimatedComponent('span'): $FlowFixMe), - /* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive - * types. Plain intrinsic components can't be typed like this */ - img: (AnimatedImplementation.createAnimatedComponent('img'): $FlowFixMe), + div: AnimatedImplementation.createAnimatedComponent< + React.PropsOf<'div'>, + mixed, + >( + /* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive + * types. Plain intrinsic components can't be typed like this */ + 'div', + ) as AnimatedComponentType>, + span: AnimatedImplementation.createAnimatedComponent< + React.PropsOf<'span'>, + mixed, + >( + /* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive + * types. Plain intrinsic components can't be typed like this */ + 'span', + ) as AnimatedComponentType>, + img: AnimatedImplementation.createAnimatedComponent< + React.PropsOf<'img'>, + mixed, + >( + /* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive + * types. Plain intrinsic components can't be typed like this */ + 'img', + ) as AnimatedComponentType>, }; 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 32b72e85d0b..375fd4ebfb2 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 @@ -342,9 +342,9 @@ exports[`public API should not change unintentionally Libraries/Animated/Animate exports[`public API should not change unintentionally Libraries/Animated/AnimatedWeb.js 1`] = ` "declare export default { ...AnimatedImplementation, - div: $FlowFixMe, - span: $FlowFixMe, - img: $FlowFixMe, + div: AnimatedComponentType>, + span: AnimatedComponentType>, + img: AnimatedComponentType>, }; " `;