From 83a1791991a22fd0ae486fc6a1fcfdd948499332 Mon Sep 17 00:00:00 2001 From: Evan Yeung Date: Wed, 10 Nov 2021 15:38:09 -0800 Subject: [PATCH] Manually fix types for LTI annotations in xplat/js Summary: This diff makes the manual changes necessary to fix many of the errors in the stacked diff codemod. See https://fb.workplace.com/groups/flowlang/posts/917522612186736 for details on this effort. Reviewed By: bradzacher Differential Revision: D31615035 fbshipit-source-id: 179b2df516833d59873b9003350f81eb4a6b4e9d --- Libraries/Animated/nodes/AnimatedValue.js | 3 ++- Libraries/Image/ImageBackground.js | 11 ++++++++++- Libraries/LogBox/UI/LogBoxNotification.js | 9 ++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Libraries/Animated/nodes/AnimatedValue.js b/Libraries/Animated/nodes/AnimatedValue.js index ac3d72915b4116..125f78ed88a3ed 100644 --- a/Libraries/Animated/nodes/AnimatedValue.js +++ b/Libraries/Animated/nodes/AnimatedValue.js @@ -15,6 +15,7 @@ const AnimatedWithChildren = require('./AnimatedWithChildren'); const InteractionManager = require('../../Interaction/InteractionManager'); const NativeAnimatedHelper = require('../NativeAnimatedHelper'); +import type AnimatedNode from './AnimatedNode'; import type Animation, {EndCallback} from '../animations/Animation'; import type {InterpolationConfigType} from './AnimatedInterpolation'; import type AnimatedTracking from './AnimatedTracking'; @@ -45,7 +46,7 @@ const NativeAnimatedAPI = NativeAnimatedHelper.API; */ function _flush(rootNode: AnimatedValue): void { const animatedStyles = new Set(); - function findAnimatedStyles(node) { + function findAnimatedStyles(node: AnimatedValue | AnimatedNode) { /* $FlowFixMe[prop-missing] (>=0.68.0 site=react_native_fb) This comment * suppresses an error found when Flow v0.68 was deployed. To see the error * delete this comment and run Flow. */ diff --git a/Libraries/Image/ImageBackground.js b/Libraries/Image/ImageBackground.js index 5d0de1ca1ac28c..445b66dbc381c5 100644 --- a/Libraries/Image/ImageBackground.js +++ b/Libraries/Image/ImageBackground.js @@ -15,7 +15,9 @@ import * as React from 'react'; import StyleSheet from '../StyleSheet/StyleSheet'; import flattenStyle from '../StyleSheet/flattenStyle'; import View from '../Components/View/View'; +import type {HostComponent} from '../Renderer/shims/ReactNativeTypes'; import type {ImageBackgroundProps} from './ImageProps'; +import type {ViewProps} from '../Components/View/ViewPropTypes'; /** * Very simple drop-in replacement for which supports nesting views. @@ -52,7 +54,14 @@ class ImageBackground extends React.Component { _viewRef: ?React.ElementRef = null; - _captureRef = ref => { + _captureRef = ( + ref: null | React$ElementRef< + React$AbstractComponent< + ViewProps, + React.ElementRef>, + >, + >, + ) => { this._viewRef = ref; }; diff --git a/Libraries/LogBox/UI/LogBoxNotification.js b/Libraries/LogBox/UI/LogBoxNotification.js index 81a0e2e130df87..c5ed4ff4dc83ed 100644 --- a/Libraries/LogBox/UI/LogBoxNotification.js +++ b/Libraries/LogBox/UI/LogBoxNotification.js @@ -8,6 +8,7 @@ * @format */ +import type {Message as MessageType} from '../Data/parseLogBoxLog'; import * as React from 'react'; import Image from '../../Image/Image'; import StyleSheet from '../../StyleSheet/StyleSheet'; @@ -54,7 +55,9 @@ function LogBoxLogNotification(props: Props): React.Node { ); } -function CountBadge(props) { +function CountBadge( + props: $TEMPORARY$object<{count: number, level: 'error' | 'warn'}>, +) { return ( {/* $FlowFixMe[incompatible-type] (>=0.114.0) This suppression was added @@ -69,7 +72,7 @@ function CountBadge(props) { ); } -function Message(props) { +function Message(props: $TEMPORARY$object<{message: MessageType}>) { return ( @@ -85,7 +88,7 @@ function Message(props) { ); } -function DismissButton(props) { +function DismissButton(props: $TEMPORARY$object<{onPress: () => void}>) { return (