Skip to content

Commit 647ca90

Browse files
coadofacebook-github-bot
authored andcommittedJan 14, 2025·
Replace $FlowFixMe in AnimatedWeb (#48633)
Summary: Pull Request resolved: #48633 Changelog: [General][Changed] - Improved types in AnimatedWeb Reviewed By: huntie Differential Revision: D68092072 fbshipit-source-id: 396efffc64030b0b2d4085f969b92c422b227c0d
1 parent 2d320fb commit 647ca90

File tree

2 files changed

+30
-12
lines changed

2 files changed

+30
-12
lines changed
 

‎packages/react-native/Libraries/Animated/AnimatedWeb.js

+27-9
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,35 @@
1010

1111
'use strict';
1212

13+
import type {AnimatedComponentType} from './createAnimatedComponent';
14+
1315
import AnimatedImplementation from './AnimatedImplementation';
16+
import React from 'react';
1417

1518
export default {
1619
...AnimatedImplementation,
17-
/* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive
18-
* types. Plain intrinsic components can't be typed like this */
19-
div: (AnimatedImplementation.createAnimatedComponent('div'): $FlowFixMe),
20-
/* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive
21-
* types. Plain intrinsic components can't be typed like this */
22-
span: (AnimatedImplementation.createAnimatedComponent('span'): $FlowFixMe),
23-
/* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive
24-
* types. Plain intrinsic components can't be typed like this */
25-
img: (AnimatedImplementation.createAnimatedComponent('img'): $FlowFixMe),
20+
div: AnimatedImplementation.createAnimatedComponent<
21+
React.PropsOf<'div'>,
22+
mixed,
23+
>(
24+
/* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive
25+
* types. Plain intrinsic components can't be typed like this */
26+
'div',
27+
) as AnimatedComponentType<React.PropsOf<'div'>>,
28+
span: AnimatedImplementation.createAnimatedComponent<
29+
React.PropsOf<'span'>,
30+
mixed,
31+
>(
32+
/* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive
33+
* types. Plain intrinsic components can't be typed like this */
34+
'span',
35+
) as AnimatedComponentType<React.PropsOf<'span'>>,
36+
img: AnimatedImplementation.createAnimatedComponent<
37+
React.PropsOf<'img'>,
38+
mixed,
39+
>(
40+
/* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive
41+
* types. Plain intrinsic components can't be typed like this */
42+
'img',
43+
) as AnimatedComponentType<React.PropsOf<'img'>>,
2644
};

‎packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap

+3-3
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,9 @@ exports[`public API should not change unintentionally Libraries/Animated/Animate
342342
exports[`public API should not change unintentionally Libraries/Animated/AnimatedWeb.js 1`] = `
343343
"declare export default {
344344
...AnimatedImplementation,
345-
div: $FlowFixMe,
346-
span: $FlowFixMe,
347-
img: $FlowFixMe,
345+
div: AnimatedComponentType<React.PropsOf<\\"div\\">>,
346+
span: AnimatedComponentType<React.PropsOf<\\"span\\">>,
347+
img: AnimatedComponentType<React.PropsOf<\\"img\\">>,
348348
};
349349
"
350350
`;

0 commit comments

Comments
 (0)
Please sign in to comment.