Replace $FlowFixMe in AnimatedWeb (#48633)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48633

Changelog:
[General][Changed] - Improved types in AnimatedWeb

Reviewed By: huntie

Differential Revision: D68092072

fbshipit-source-id: 396efffc64030b0b2d4085f969b92c422b227c0d
This commit is contained in:
Dawid Małecki
2025-01-14 02:59:52 -08:00
committed by Facebook GitHub Bot
parent 2d320fbd76
commit 647ca90a30
2 changed files with 30 additions and 12 deletions
+27 -9
View File
@@ -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<React.PropsOf<'div'>>,
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<React.PropsOf<'span'>>,
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<React.PropsOf<'img'>>,
};
@@ -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<React.PropsOf<\\"div\\">>,
span: AnimatedComponentType<React.PropsOf<\\"span\\">>,
img: AnimatedComponentType<React.PropsOf<\\"img\\">>,
};
"
`;