diff --git a/IntegrationTests/AccessibilityManagerTest.js b/IntegrationTests/AccessibilityManagerTest.js index 313b8990346..dd155cec22c 100644 --- a/IntegrationTests/AccessibilityManagerTest.js +++ b/IntegrationTests/AccessibilityManagerTest.js @@ -18,7 +18,7 @@ const {TestModule} = ReactNative.NativeModules; import NativeAccessibilityManager from 'react-native/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager'; import invariant from 'invariant'; -class AccessibilityManagerTest extends React.Component<{}> { +class AccessibilityManagerTest extends React.Component<{...}> { componentDidMount() { invariant( NativeAccessibilityManager, diff --git a/IntegrationTests/AppEventsTest.js b/IntegrationTests/AppEventsTest.js index 4bc0b0649c1..650203ed233 100644 --- a/IntegrationTests/AppEventsTest.js +++ b/IntegrationTests/AppEventsTest.js @@ -19,14 +19,19 @@ const deepDiffer = require('react-native/Libraries/Utilities/differ/deepDiffer') const TEST_PAYLOAD = {foo: 'bar'}; -type AppEvent = {data: Object, ts: number}; +type AppEvent = { + data: Object, + ts: number, + ... +}; type State = { sent: 'none' | AppEvent, received: 'none' | AppEvent, elapsed?: string, + ... }; -class AppEventsTest extends React.Component<{}, State> { +class AppEventsTest extends React.Component<{...}, State> { state: State = {sent: 'none', received: 'none'}; componentDidMount() { diff --git a/IntegrationTests/AsyncStorageTest.js b/IntegrationTests/AsyncStorageTest.js index 070e711b7e5..e33cedfdd82 100644 --- a/IntegrationTests/AsyncStorageTest.js +++ b/IntegrationTests/AsyncStorageTest.js @@ -171,7 +171,7 @@ function testOptimizedMultiGet() { }); } -class AsyncStorageTest extends React.Component<{}, $FlowFixMeState> { +class AsyncStorageTest extends React.Component<{...}, $FlowFixMeState> { state: any | {|done: boolean, messages: string|} = { messages: 'Initializing...', done: false, diff --git a/IntegrationTests/GlobalEvalWithSourceUrlTest.js b/IntegrationTests/GlobalEvalWithSourceUrlTest.js index 0fd59bc2644..52fbe0e2fa8 100644 --- a/IntegrationTests/GlobalEvalWithSourceUrlTest.js +++ b/IntegrationTests/GlobalEvalWithSourceUrlTest.js @@ -17,7 +17,7 @@ const {View} = ReactNative; const {TestModule} = ReactNative.NativeModules; -class GlobalEvalWithSourceUrlTest extends React.Component<{}> { +class GlobalEvalWithSourceUrlTest extends React.Component<{...}> { componentDidMount() { if (typeof global.globalEvalWithSourceUrl !== 'function') { throw new Error( diff --git a/IntegrationTests/ImageCachePolicyTest.js b/IntegrationTests/ImageCachePolicyTest.js index e3c6556d2b1..03857091072 100644 --- a/IntegrationTests/ImageCachePolicyTest.js +++ b/IntegrationTests/ImageCachePolicyTest.js @@ -27,12 +27,13 @@ const {TestModule} = ReactNative.NativeModules; const TESTS = ['only-if-cached', 'default', 'reload', 'force-cache']; -type Props = {}; +type Props = {...}; type State = { 'only-if-cached'?: boolean, default?: boolean, reload?: boolean, 'force-cache'?: boolean, + ... }; class ImageCachePolicyTest extends React.Component { diff --git a/IntegrationTests/ImageSnapshotTest.js b/IntegrationTests/ImageSnapshotTest.js index 495423ae006..cff8a5adb59 100644 --- a/IntegrationTests/ImageSnapshotTest.js +++ b/IntegrationTests/ImageSnapshotTest.js @@ -15,7 +15,7 @@ const ReactNative = require('react-native'); const {Image} = ReactNative; const {TestModule} = ReactNative.NativeModules; -class ImageSnapshotTest extends React.Component<{}> { +class ImageSnapshotTest extends React.Component<{...}> { componentDidMount() { if (!TestModule.verifySnapshot) { throw new Error('TestModule.verifySnapshot not defined.'); diff --git a/IntegrationTests/IntegrationTestsApp.js b/IntegrationTests/IntegrationTestsApp.js index c8af81bf126..c52fe515221 100644 --- a/IntegrationTests/IntegrationTestsApp.js +++ b/IntegrationTests/IntegrationTestsApp.js @@ -51,7 +51,7 @@ require('./LoggingTestModule'); type Test = any; -class IntegrationTestsApp extends React.Component<{}, $FlowFixMeState> { +class IntegrationTestsApp extends React.Component<{...}, $FlowFixMeState> { state = { test: (null: ?Test), }; diff --git a/IntegrationTests/LayoutEventsTest.js b/IntegrationTests/LayoutEventsTest.js index 42def2c419b..bbbad14faf3 100644 --- a/IntegrationTests/LayoutEventsTest.js +++ b/IntegrationTests/LayoutEventsTest.js @@ -38,6 +38,7 @@ type State = { viewLayout?: Layout, viewStyle?: ViewStyleProp, containerStyle?: ViewStyleProp, + ... }; class LayoutEventsTest extends React.Component { diff --git a/IntegrationTests/PromiseTest.js b/IntegrationTests/PromiseTest.js index b35c971fc34..809f6eb873d 100644 --- a/IntegrationTests/PromiseTest.js +++ b/IntegrationTests/PromiseTest.js @@ -15,7 +15,7 @@ const ReactNative = require('react-native'); const {View} = ReactNative; const {TestModule} = ReactNative.NativeModules; -class PromiseTest extends React.Component<{}> { +class PromiseTest extends React.Component<{...}> { shouldResolve: boolean = false; shouldReject: boolean = false; shouldSucceedAsync: boolean = false; diff --git a/IntegrationTests/SimpleSnapshotTest.js b/IntegrationTests/SimpleSnapshotTest.js index 90cb3f1e17c..d2501222da0 100644 --- a/IntegrationTests/SimpleSnapshotTest.js +++ b/IntegrationTests/SimpleSnapshotTest.js @@ -18,7 +18,7 @@ const requestAnimationFrame = require('fbjs/lib/requestAnimationFrame'); const {StyleSheet, View} = ReactNative; const {TestModule} = ReactNative.NativeModules; -class SimpleSnapshotTest extends React.Component<{}> { +class SimpleSnapshotTest extends React.Component<{...}> { componentDidMount() { if (!TestModule.verifySnapshot) { throw new Error('TestModule.verifySnapshot not defined.'); diff --git a/IntegrationTests/SizeFlexibilityUpdateTest.js b/IntegrationTests/SizeFlexibilityUpdateTest.js index 419083c57a3..df3b5619087 100644 --- a/IntegrationTests/SizeFlexibilityUpdateTest.js +++ b/IntegrationTests/SizeFlexibilityUpdateTest.js @@ -54,7 +54,8 @@ class SizeFlexibilityUpdateTest extends React.Component { rootViewDidChangeIntrinsicSize: (intrinsicSize: { height: number, width: number, - }) => void = (intrinsicSize: {width: number, height: number}) => { + ... + }) => void = (intrinsicSize: {width: number, height: number, ...}) => { if (finalState) { // If a test reaches its final state, it is not expected to do anything more TestModule.markTestPassed(false); diff --git a/IntegrationTests/SyncMethodTest.js b/IntegrationTests/SyncMethodTest.js index 8dbb5b94ad7..077884256d2 100644 --- a/IntegrationTests/SyncMethodTest.js +++ b/IntegrationTests/SyncMethodTest.js @@ -16,7 +16,7 @@ const {View} = ReactNative; const {TestModule, RNTesterTestModule} = ReactNative.NativeModules; -class SyncMethodTest extends React.Component<{}> { +class SyncMethodTest extends React.Component<{...}> { componentDidMount() { if ( RNTesterTestModule.echoString('test string value') !== 'test string value' diff --git a/IntegrationTests/WebSocketTest.js b/IntegrationTests/WebSocketTest.js index fcc2d74cb8d..3435feabb11 100644 --- a/IntegrationTests/WebSocketTest.js +++ b/IntegrationTests/WebSocketTest.js @@ -28,9 +28,10 @@ type State = { lastMessage: ?string | ?ArrayBuffer, testMessage: string, testExpectedResponse: string, + ... }; -class WebSocketTest extends React.Component<{}, State> { +class WebSocketTest extends React.Component<{...}, State> { state: State = { url: DEFAULT_WS_URL, fetchStatus: null, diff --git a/Libraries/Alert/Alert.js b/Libraries/Alert/Alert.js index 55bdce3fd40..88873c5aa60 100644 --- a/Libraries/Alert/Alert.js +++ b/Libraries/Alert/Alert.js @@ -26,11 +26,13 @@ export type Buttons = Array<{ text?: string, onPress?: ?Function, style?: AlertButtonStyle, + ... }>; type Options = { cancelable?: ?boolean, onDismiss?: ?() => void, + ... }; /** diff --git a/Libraries/Animated/src/AnimatedEvent.js b/Libraries/Animated/src/AnimatedEvent.js index 01c850daf37..e3c0b814cf8 100644 --- a/Libraries/Animated/src/AnimatedEvent.js +++ b/Libraries/Animated/src/AnimatedEvent.js @@ -18,10 +18,11 @@ const invariant = require('invariant'); const {shouldUseNativeDriver} = require('./NativeAnimatedHelper'); -export type Mapping = {[key: string]: Mapping} | AnimatedValue; +export type Mapping = {[key: string]: Mapping, ...} | AnimatedValue; export type EventConfig = { listener?: ?Function, useNativeDriver: boolean, + ... }; function attachNativeEvent( @@ -87,9 +88,7 @@ class AnimatedEvent { _argMapping: Array; _listeners: Array = []; _callListeners: Function; - _attachedEvent: ?{ - detach: () => void, - }; + _attachedEvent: ?{detach: () => void, ...}; __isNative: boolean; constructor(argMapping: Array, config: EventConfig) { diff --git a/Libraries/Animated/src/AnimatedImplementation.js b/Libraries/Animated/src/AnimatedImplementation.js index 9339044ce76..a1ce333acd2 100644 --- a/Libraries/Animated/src/AnimatedImplementation.js +++ b/Libraries/Animated/src/AnimatedImplementation.js @@ -46,6 +46,7 @@ export type CompositeAnimation = { reset: () => void, _startNativeLoop: (iterations?: number) => void, _isUsingNativeDriver: () => boolean, + ... }; const add = function( @@ -341,7 +342,9 @@ const sequence = function( }; type ParallelConfig = { - stopTogether?: boolean, // If one is stopped, stop all. default: true + // If one is stopped, stop all. default: true + stopTogether?: boolean, + ... }; const parallel = function( animations: Array, @@ -435,6 +438,7 @@ const stagger = function( type LoopAnimationConfig = { iterations: number, resetBeforeIteration?: boolean, + ... }; const loop = function( diff --git a/Libraries/Animated/src/AnimatedMock.js b/Libraries/Animated/src/AnimatedMock.js index b6eecf3031a..eecfbb884ec 100644 --- a/Libraries/Animated/src/AnimatedMock.js +++ b/Libraries/Animated/src/AnimatedMock.js @@ -37,6 +37,7 @@ export type CompositeAnimation = { reset: () => void, _startNativeLoop: (iterations?: number) => void, _isUsingNativeDriver: () => boolean, + ... }; const emptyAnimation = { @@ -90,9 +91,7 @@ const sequence = function( return emptyAnimation; }; -type ParallelConfig = { - stopTogether?: boolean, -}; +type ParallelConfig = {stopTogether?: boolean, ...}; const parallel = function( animations: Array, config?: ?ParallelConfig, @@ -111,7 +110,11 @@ const stagger = function( return emptyAnimation; }; -type LoopAnimationConfig = {iterations: number, resetBeforeIteration?: boolean}; +type LoopAnimationConfig = { + iterations: number, + resetBeforeIteration?: boolean, + ... +}; const loop = function( animation: CompositeAnimation, diff --git a/Libraries/Animated/src/NativeAnimatedHelper.js b/Libraries/Animated/src/NativeAnimatedHelper.js index 41d0e52e60d..25fde53b628 100644 --- a/Libraries/Animated/src/NativeAnimatedHelper.js +++ b/Libraries/Animated/src/NativeAnimatedHelper.js @@ -217,8 +217,18 @@ function addWhitelistedInterpolationParam(param: string): void { function validateTransform( configs: Array< - | {type: 'animated', property: string, nodeTag: ?number} - | {type: 'static', property: string, value: number | string}, + | { + type: 'animated', + property: string, + nodeTag: ?number, + ... + } + | { + type: 'static', + property: string, + value: number | string, + ... + }, >, ): void { configs.forEach(config => { @@ -232,7 +242,7 @@ function validateTransform( }); } -function validateStyles(styles: {[key: string]: ?number}): void { +function validateStyles(styles: {[key: string]: ?number, ...}): void { for (const key in styles) { if (!STYLES_WHITELIST.hasOwnProperty(key)) { throw new Error( diff --git a/Libraries/Animated/src/NativeAnimatedModule.js b/Libraries/Animated/src/NativeAnimatedModule.js index aa9e1257d2c..fc76ec1953a 100644 --- a/Libraries/Animated/src/NativeAnimatedModule.js +++ b/Libraries/Animated/src/NativeAnimatedModule.js @@ -13,7 +13,7 @@ import type {TurboModule} from '../../TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; -type EndResult = {finished: boolean}; +type EndResult = {finished: boolean, ...}; type EndCallback = (result: EndResult) => void; export type EventMapping = {| diff --git a/Libraries/Animated/src/SpringConfig.js b/Libraries/Animated/src/SpringConfig.js index e226a3173a1..5dd212ca110 100644 --- a/Libraries/Animated/src/SpringConfig.js +++ b/Libraries/Animated/src/SpringConfig.js @@ -13,6 +13,7 @@ type SpringConfigType = { stiffness: number, damping: number, + ... }; function stiffnessFromOrigamiValue(oValue) { diff --git a/Libraries/Animated/src/animations/Animation.js b/Libraries/Animated/src/animations/Animation.js index 54de2d005ef..4d2ac807523 100644 --- a/Libraries/Animated/src/animations/Animation.js +++ b/Libraries/Animated/src/animations/Animation.js @@ -14,7 +14,7 @@ const NativeAnimatedHelper = require('../NativeAnimatedHelper'); import type AnimatedValue from '../nodes/AnimatedValue'; -export type EndResult = {finished: boolean}; +export type EndResult = {finished: boolean, ...}; export type EndCallback = (result: EndResult) => void; export type AnimationConfig = { @@ -22,6 +22,7 @@ export type AnimationConfig = { useNativeDriver: boolean, onComplete?: ?EndCallback, iterations?: number, + ... }; // Important note: start() and stop() will only be called at most once. diff --git a/Libraries/Animated/src/animations/DecayAnimation.js b/Libraries/Animated/src/animations/DecayAnimation.js index 8c7e74c1ab7..6f4039cf40e 100644 --- a/Libraries/Animated/src/animations/DecayAnimation.js +++ b/Libraries/Animated/src/animations/DecayAnimation.js @@ -18,13 +18,21 @@ import type AnimatedValue from '../nodes/AnimatedValue'; import type {AnimationConfig, EndCallback} from './Animation'; export type DecayAnimationConfig = AnimationConfig & { - velocity: number | {x: number, y: number}, + velocity: + | number + | { + x: number, + y: number, + ... + }, deceleration?: number, + ... }; export type DecayAnimationConfigSingle = AnimationConfig & { velocity: number, deceleration?: number, + ... }; class DecayAnimation extends Animation { diff --git a/Libraries/Animated/src/animations/SpringAnimation.js b/Libraries/Animated/src/animations/SpringAnimation.js index d099f8a0c75..61ff7cfa7cc 100644 --- a/Libraries/Animated/src/animations/SpringAnimation.js +++ b/Libraries/Animated/src/animations/SpringAnimation.js @@ -22,11 +22,25 @@ const {shouldUseNativeDriver} = require('../NativeAnimatedHelper'); import type {AnimationConfig, EndCallback} from './Animation'; export type SpringAnimationConfig = AnimationConfig & { - toValue: number | AnimatedValue | {x: number, y: number} | AnimatedValueXY, + toValue: + | number + | AnimatedValue + | { + x: number, + y: number, + ... + } + | AnimatedValueXY, overshootClamping?: boolean, restDisplacementThreshold?: number, restSpeedThreshold?: number, - velocity?: number | {x: number, y: number}, + velocity?: + | number + | { + x: number, + y: number, + ... + }, bounciness?: number, speed?: number, tension?: number, @@ -35,6 +49,7 @@ export type SpringAnimationConfig = AnimationConfig & { damping?: number, mass?: number, delay?: number, + ... }; export type SpringAnimationConfigSingle = AnimationConfig & { @@ -51,6 +66,7 @@ export type SpringAnimationConfigSingle = AnimationConfig & { damping?: number, mass?: number, delay?: number, + ... }; class SpringAnimation extends Animation { diff --git a/Libraries/Animated/src/animations/TimingAnimation.js b/Libraries/Animated/src/animations/TimingAnimation.js index 323b512208e..f88f7207e60 100644 --- a/Libraries/Animated/src/animations/TimingAnimation.js +++ b/Libraries/Animated/src/animations/TimingAnimation.js @@ -19,10 +19,19 @@ const {shouldUseNativeDriver} = require('../NativeAnimatedHelper'); import type {AnimationConfig, EndCallback} from './Animation'; export type TimingAnimationConfig = AnimationConfig & { - toValue: number | AnimatedValue | {x: number, y: number} | AnimatedValueXY, + toValue: + | number + | AnimatedValue + | { + x: number, + y: number, + ... + } + | AnimatedValueXY, easing?: (value: number) => number, duration?: number, delay?: number, + ... }; export type TimingAnimationConfigSingle = AnimationConfig & { @@ -30,6 +39,7 @@ export type TimingAnimationConfigSingle = AnimationConfig & { easing?: (value: number) => number, duration?: number, delay?: number, + ... }; let _easeInOut; diff --git a/Libraries/Animated/src/createAnimatedComponent.js b/Libraries/Animated/src/createAnimatedComponent.js index d803781e158..0672962354a 100644 --- a/Libraries/Animated/src/createAnimatedComponent.js +++ b/Libraries/Animated/src/createAnimatedComponent.js @@ -18,11 +18,11 @@ const invariant = require('invariant'); const setAndForwardRef = require('../../Utilities/setAndForwardRef'); export type AnimatedComponentType< - Props: {+[string]: mixed}, + Props: {+[string]: mixed, ...}, Instance, > = React.AbstractComponent<$ObjMap any>, Instance>; -function createAnimatedComponent( +function createAnimatedComponent( Component: React.AbstractComponent, ): AnimatedComponentType { invariant( diff --git a/Libraries/Animated/src/nodes/AnimatedInterpolation.js b/Libraries/Animated/src/nodes/AnimatedInterpolation.js index 4fdb3447838..de029222c4e 100644 --- a/Libraries/Animated/src/nodes/AnimatedInterpolation.js +++ b/Libraries/Animated/src/nodes/AnimatedInterpolation.js @@ -32,6 +32,7 @@ export type InterpolationConfigType = { extrapolate?: ExtrapolateType, extrapolateLeft?: ExtrapolateType, extrapolateRight?: ExtrapolateType, + ... }; const linear = t => t; diff --git a/Libraries/Animated/src/nodes/AnimatedNode.js b/Libraries/Animated/src/nodes/AnimatedNode.js index ab0feac1846..4b6a079bf73 100644 --- a/Libraries/Animated/src/nodes/AnimatedNode.js +++ b/Libraries/Animated/src/nodes/AnimatedNode.js @@ -15,14 +15,14 @@ const NativeAnimatedHelper = require('../NativeAnimatedHelper'); const NativeAnimatedAPI = NativeAnimatedHelper.API; const invariant = require('invariant'); -type ValueListenerCallback = (state: {value: number}) => mixed; +type ValueListenerCallback = (state: {value: number, ...}) => mixed; let _uniqueId = 1; // Note(vjeux): this would be better as an interface but flow doesn't // support them yet class AnimatedNode { - _listeners: {[key: string]: ValueListenerCallback}; + _listeners: {[key: string]: ValueListenerCallback, ...}; __nativeAnimatedValueListener: ?any; __attach(): void {} __detach(): void { diff --git a/Libraries/Animated/src/nodes/AnimatedValueXY.js b/Libraries/Animated/src/nodes/AnimatedValueXY.js index 7494d0bda8c..2e845b26219 100644 --- a/Libraries/Animated/src/nodes/AnimatedValueXY.js +++ b/Libraries/Animated/src/nodes/AnimatedValueXY.js @@ -15,7 +15,11 @@ const AnimatedWithChildren = require('./AnimatedWithChildren'); const invariant = require('invariant'); -type ValueXYListenerCallback = (value: {x: number, y: number}) => mixed; +type ValueXYListenerCallback = (value: { + x: number, + y: number, + ... +}) => mixed; let _uniqueId = 1; @@ -28,10 +32,21 @@ let _uniqueId = 1; class AnimatedValueXY extends AnimatedWithChildren { x: AnimatedValue; y: AnimatedValue; - _listeners: {[key: string]: {x: string, y: string}}; + _listeners: { + [key: string]: { + x: string, + y: string, + ... + }, + ..., + }; constructor( - valueIn?: ?{+x: number | AnimatedValue, +y: number | AnimatedValue}, + valueIn?: ?{ + +x: number | AnimatedValue, + +y: number | AnimatedValue, + ... + }, ) { super(); const value: any = valueIn || {x: 0, y: 0}; // @flowfixme: shouldn't need `: any` @@ -56,7 +71,7 @@ class AnimatedValueXY extends AnimatedWithChildren { * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html#setvalue */ - setValue(value: {x: number, y: number}) { + setValue(value: {x: number, y: number, ...}) { this.x.setValue(value.x); this.y.setValue(value.y); } @@ -68,7 +83,7 @@ class AnimatedValueXY extends AnimatedWithChildren { * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html#setoffset */ - setOffset(offset: {x: number, y: number}) { + setOffset(offset: {x: number, y: number, ...}) { this.x.setOffset(offset.x); this.y.setOffset(offset.y); } @@ -95,7 +110,11 @@ class AnimatedValueXY extends AnimatedWithChildren { this.y.extractOffset(); } - __getValue(): {x: number, y: number} { + __getValue(): { + x: number, + y: number, + ... + } { return { x: this.x.__getValue(), y: this.y.__getValue(), @@ -107,7 +126,13 @@ class AnimatedValueXY extends AnimatedWithChildren { * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html#resetanimation */ - resetAnimation(callback?: (value: {x: number, y: number}) => void): void { + resetAnimation( + callback?: (value: { + x: number, + y: number, + ... + }) => void, + ): void { this.x.resetAnimation(); this.y.resetAnimation(); callback && callback(this.__getValue()); @@ -120,7 +145,13 @@ class AnimatedValueXY extends AnimatedWithChildren { * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html#stopanimation */ - stopAnimation(callback?: (value: {x: number, y: number}) => void): void { + stopAnimation( + callback?: (value: { + x: number, + y: number, + ... + }) => void, + ): void { this.x.stopAnimation(); this.y.stopAnimation(); callback && callback(this.__getValue()); @@ -175,7 +206,7 @@ class AnimatedValueXY extends AnimatedWithChildren { * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html#getlayout */ - getLayout(): {[key: string]: AnimatedValue} { + getLayout(): {[key: string]: AnimatedValue, ...} { return { left: this.x, top: this.y, @@ -187,7 +218,7 @@ class AnimatedValueXY extends AnimatedWithChildren { * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html#gettranslatetransform */ - getTranslateTransform(): Array<{[key: string]: AnimatedValue}> { + getTranslateTransform(): Array<{[key: string]: AnimatedValue, ...}> { return [{translateX: this.x}, {translateY: this.y}]; } } diff --git a/Libraries/BatchedBridge/MessageQueue.js b/Libraries/BatchedBridge/MessageQueue.js index 37d35b659b7..8c35ee9f8ea 100644 --- a/Libraries/BatchedBridge/MessageQueue.js +++ b/Libraries/BatchedBridge/MessageQueue.js @@ -23,6 +23,7 @@ export type SpyData = { module: ?string, method: string | number, args: any[], + ... }; const TO_JS = 0; @@ -39,7 +40,7 @@ const TRACE_TAG_REACT_APPS = 1 << 17; const DEBUG_INFO_LIMIT = 32; class MessageQueue { - _lazyCallableModules: {[key: string]: (void) => Object}; + _lazyCallableModules: {[key: string]: (void) => Object, ...}; _queue: [number[], number[], any[], number]; _successCallbacks: Map; _failureCallbacks: Map; @@ -48,9 +49,9 @@ class MessageQueue { _eventLoopStartTime: number; _immediatesCallback: ?() => void; - _debugInfo: {[number]: [number, number]}; - _remoteModuleTable: {[number]: string}; - _remoteMethodTable: {[number]: $ReadOnlyArray}; + _debugInfo: {[number]: [number, number], ...}; + _remoteModuleTable: {[number]: string, ...}; + _remoteMethodTable: {[number]: $ReadOnlyArray, ...}; __spy: ?(data: SpyData) => void; diff --git a/Libraries/BatchedBridge/NativeModules.js b/Libraries/BatchedBridge/NativeModules.js index a0c5b074b59..541012582c0 100644 --- a/Libraries/BatchedBridge/NativeModules.js +++ b/Libraries/BatchedBridge/NativeModules.js @@ -29,7 +29,11 @@ export type MethodType = 'async' | 'promise' | 'sync'; function genModule( config: ?ModuleConfig, moduleID: number, -): ?{name: string, module?: Object} { +): ?{ + name: string, + module?: Object, + ... +} { if (!config) { return null; } @@ -151,13 +155,13 @@ function arrayContains(array: $ReadOnlyArray, value: T): boolean { } function updateErrorWithErrorData( - errorData: {message: string}, + errorData: {message: string, ...}, error: ExtendedError, ): ExtendedError { return Object.assign(error, errorData || {}); } -let NativeModules: {[moduleName: string]: Object} = {}; +let NativeModules: {[moduleName: string]: Object, ...} = {}; if (global.nativeModuleProxy) { NativeModules = global.nativeModuleProxy; } else if (!global.nativeExtensions) { diff --git a/Libraries/Blob/BlobRegistry.js b/Libraries/Blob/BlobRegistry.js index f3cd13ebc48..ce1eaed3404 100644 --- a/Libraries/Blob/BlobRegistry.js +++ b/Libraries/Blob/BlobRegistry.js @@ -8,7 +8,7 @@ * @format */ -const registry: {[key: string]: number} = {}; +const registry: {[key: string]: number, ...} = {}; const register = (id: string) => { if (registry[id]) { diff --git a/Libraries/Blob/BlobTypes.js b/Libraries/Blob/BlobTypes.js index cbd49b90160..cae2ee1f42c 100644 --- a/Libraries/Blob/BlobTypes.js +++ b/Libraries/Blob/BlobTypes.js @@ -10,7 +10,7 @@ 'use strict'; -export opaque type BlobCollector = {}; +export opaque type BlobCollector = {...}; export type BlobData = { blobId: string, @@ -20,9 +20,11 @@ export type BlobData = { type?: string, lastModified?: number, __collector?: ?BlobCollector, + ... }; export type BlobOptions = { type: string, lastModified: number, + ... }; diff --git a/Libraries/BugReporting/BugReporting.js b/Libraries/BugReporting/BugReporting.js index ba36324d619..04595e83726 100644 --- a/Libraries/BugReporting/BugReporting.js +++ b/Libraries/BugReporting/BugReporting.js @@ -16,9 +16,13 @@ import type EmitterSubscription from '../vendor/emitter/EmitterSubscription'; import NativeBugReporting from './NativeBugReporting'; import NativeRedBox from '../NativeModules/specs/NativeRedBox'; -type ExtraData = {[key: string]: string}; +type ExtraData = {[key: string]: string, ...}; type SourceCallback = () => string; -type DebugData = {extras: ExtraData, files: ExtraData}; +type DebugData = { + extras: ExtraData, + files: ExtraData, + ... +}; function defaultExtras() { BugReporting.addFileSource('react_hierarchy.txt', () => @@ -68,7 +72,7 @@ class BugReporting { static addSource( key: string, callback: SourceCallback, - ): {remove: () => void} { + ): {remove: () => void, ...} { return this._addSource(key, callback, BugReporting._extraSources); } @@ -83,7 +87,7 @@ class BugReporting { static addFileSource( key: string, callback: SourceCallback, - ): {remove: () => void} { + ): {remove: () => void, ...} { return this._addSource(key, callback, BugReporting._fileSources); } @@ -91,7 +95,7 @@ class BugReporting { key: string, callback: SourceCallback, source: Map, - ): {remove: () => void} { + ): {remove: () => void, ...} { BugReporting._maybeInit(); if (source.has(key)) { console.warn( diff --git a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js index e2db8ab1eab..1840dfce692 100644 --- a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js +++ b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js @@ -22,6 +22,7 @@ type ChangeEventName = $Keys<{ change: string, reduceMotionChanged: string, screenReaderChanged: string, + ... }>; const _subscriptions = new Map(); diff --git a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js index c82b3e31b37..4627b70d2ae 100644 --- a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js +++ b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js @@ -34,6 +34,7 @@ type ChangeEventName = $Keys<{ reduceMotionChanged: string, reduceTransparencyChanged: string, screenReaderChanged: string, + ... }>; const _subscriptions = new Map(); diff --git a/Libraries/Components/Keyboard/KeyboardAvoidingView.js b/Libraries/Components/Keyboard/KeyboardAvoidingView.js index e49e9aa7ea5..7c794ea5e8d 100644 --- a/Libraries/Components/Keyboard/KeyboardAvoidingView.js +++ b/Libraries/Components/Keyboard/KeyboardAvoidingView.js @@ -68,7 +68,7 @@ class KeyboardAvoidingView extends React.Component { _frame: ?ViewLayout = null; _subscriptions: Array = []; - viewRef: {current: React.ElementRef | null}; + viewRef: {current: React.ElementRef | null, ...}; _initialFrameHeight: number = 0; constructor(props: Props) { diff --git a/Libraries/Components/RefreshControl/RefreshControl.js b/Libraries/Components/RefreshControl/RefreshControl.js index 547b8cb7e01..43ebf012308 100644 --- a/Libraries/Components/RefreshControl/RefreshControl.js +++ b/Libraries/Components/RefreshControl/RefreshControl.js @@ -135,7 +135,7 @@ export type RefreshControlProps = $ReadOnly<{| class RefreshControl extends React.Component { static SIZE: any = RefreshLayoutConsts.SIZE; - _setNativePropsOnRef: ?({refreshing: boolean}) => void; + _setNativePropsOnRef: ?({refreshing: boolean, ...}) => void; _lastNativeRefreshing = false; componentDidMount() { diff --git a/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js b/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js index 46e91d97c59..40d41abbdc6 100644 --- a/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +++ b/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js @@ -20,7 +20,7 @@ const RCTRefreshControl: HostComponent = requireNativeComponent( 'RCTRefreshControl', ); -class RefreshControlMock extends React.Component<{}> { +class RefreshControlMock extends React.Component<{...}> { static latestRef: ?RefreshControlMock; componentDidMount() { RefreshControlMock.latestRef = this; diff --git a/Libraries/Components/ScrollResponder.js b/Libraries/Components/ScrollResponder.js index 4b282be6d51..17422571c07 100644 --- a/Libraries/Components/ScrollResponder.js +++ b/Libraries/Components/ScrollResponder.js @@ -449,7 +449,14 @@ const ScrollResponderMixin = { * This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED. */ scrollResponderScrollTo: function( - x?: number | {x?: number, y?: number, animated?: boolean}, + x?: + | number + | { + x?: number, + y?: number, + animated?: boolean, + ... + }, y?: number, animated?: boolean, ) { @@ -481,7 +488,7 @@ const ScrollResponderMixin = { * * `scrollResponderScrollToEnd({animated: true})` */ - scrollResponderScrollToEnd: function(options?: {animated?: boolean}) { + scrollResponderScrollToEnd: function(options?: {animated?: boolean, ...}) { // Default to true const animated = (options && options.animated) !== false; diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index 7e5809c800e..a3e8b0ab94c 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -73,12 +73,11 @@ export type ScrollResponderType = { getInnerViewNode: $PropertyType, getInnerViewRef: $PropertyType, getNativeScrollRef: $PropertyType, - setNativeProps: $PropertyType, scrollTo: $PropertyType, flashScrollIndicators: $PropertyType, - ...typeof ScrollResponder.Mixin, + ... }; type IOSProps = $ReadOnly<{| @@ -372,9 +371,7 @@ type VRProps = $ReadOnly<{| type StickyHeaderComponentType = React.AbstractComponent< ScrollViewStickyHeaderProps, - $ReadOnly<{ - setNextHeaderY: number => void, - }>, + $ReadOnly<{setNextHeaderY: number => void, ...}>, >; export type Props = $ReadOnly<{| @@ -702,7 +699,7 @@ class ScrollView extends React.Component { _scrollAnimatedValue: AnimatedImplementation.Value = new AnimatedImplementation.Value( 0, ); - _scrollAnimatedValueAttachment: ?{detach: () => void} = null; + _scrollAnimatedValueAttachment: ?{detach: () => void, ...} = null; _stickyHeaderRefs: Map< string, React.ElementRef, @@ -753,7 +750,7 @@ class ScrollView extends React.Component { } } - setNativeProps(props: {[key: string]: mixed}) { + setNativeProps(props: {[key: string]: mixed, ...}) { this._scrollViewRef && this._scrollViewRef.setNativeProps(props); } @@ -796,7 +793,14 @@ class ScrollView extends React.Component { * This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED. */ scrollTo( - options?: {x?: number, y?: number, animated?: boolean} | number, + options?: + | { + x?: number, + y?: number, + animated?: boolean, + ... + } + | number, deprecatedX?: number, deprecatedAnimated?: boolean, ) { @@ -829,7 +833,7 @@ class ScrollView extends React.Component { * `scrollToEnd({animated: false})` for immediate scrolling. * If no options are passed, `animated` defaults to true. */ - scrollToEnd(options?: ?{animated?: boolean}) { + scrollToEnd(options?: ?{animated?: boolean, ...}) { // Default to true const animated = (options && options.animated) !== false; this._scrollResponder.scrollResponderScrollToEnd({ diff --git a/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js b/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js index f53358d5e5d..4ea33db416b 100644 --- a/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +++ b/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js @@ -23,7 +23,6 @@ import type {PointProp} from '../../StyleSheet/PointPropType'; export type ScrollViewNativeProps = $ReadOnly<{ ...ViewProps, - alwaysBounceHorizontal?: ?boolean, alwaysBounceVertical?: ?boolean, automaticallyAdjustContentInsets?: ?boolean, @@ -78,12 +77,11 @@ export type ScrollViewNativeProps = $ReadOnly<{ snapToOffsets?: ?$ReadOnlyArray, snapToStart?: ?boolean, zoomScale?: ?number, - DEPRECATED_sendUpdatedChildFrames?: ?boolean, - // Overrides - style?: {...ViewStyleProp} | DangerouslyImpreciseStyle, + style?: {...ViewStyleProp, ...} | DangerouslyImpreciseStyle, onResponderGrant?: ?(e: any) => void | boolean, + ... }>; export type ScrollViewNativeComponentType = HostComponent; diff --git a/Libraries/Components/ScrollView/ScrollViewStickyHeader.js b/Libraries/Components/ScrollView/ScrollViewStickyHeader.js index 98a38962a75..0bc51bbfaec 100644 --- a/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +++ b/Libraries/Components/ScrollView/ScrollViewStickyHeader.js @@ -29,6 +29,7 @@ export type Props = { inverted: ?boolean, // The height of the parent ScrollView. Currently only set when inverted. scrollViewHeight: ?number, + ... }; type State = { @@ -36,6 +37,7 @@ type State = { layoutY: number, layoutHeight: number, nextHeaderLayoutY: ?number, + ... }; class ScrollViewStickyHeader extends React.Component { diff --git a/Libraries/Components/StatusBar/StatusBar.js b/Libraries/Components/StatusBar/StatusBar.js index 2dacf2f21e2..16137272440 100644 --- a/Libraries/Components/StatusBar/StatusBar.js +++ b/Libraries/Components/StatusBar/StatusBar.js @@ -34,6 +34,7 @@ export type StatusBarStyle = $Keys<{ * Light background, dark texts and icons */ 'dark-content': string, + ... }>; /** @@ -52,6 +53,7 @@ export type StatusBarAnimation = $Keys<{ * Slide animation */ slide: string, + ... }>; type AndroidProps = $ReadOnly<{| diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index 65aed75fe39..db4b7643307 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -32,7 +32,7 @@ import type {SyntheticEvent, ScrollEvent} from '../../Types/CoreEventTypes'; import type {PressEvent} from '../../Types/CoreEventTypes'; import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes'; -type ReactRefSetter = {current: null | T} | ((ref: null | T) => mixed); +type ReactRefSetter = {current: null | T, ...} | ((ref: null | T) => mixed); let AndroidTextInput; let RCTMultilineTextInputView; diff --git a/Libraries/Components/Touchable/PooledClass.js b/Libraries/Components/Touchable/PooledClass.js index f6fc1ee852f..4aee28a81c5 100644 --- a/Libraries/Components/Touchable/PooledClass.js +++ b/Libraries/Components/Touchable/PooledClass.js @@ -97,6 +97,7 @@ const addPoolingTo = function( ...args: $ReadOnlyArray ): /* arguments of the constructor */ T, release(instance: mixed): void, + ... } { // Casting as any so that flow ignores the actual implementation and trusts // it to match the type we declared diff --git a/Libraries/Components/Touchable/Touchable.js b/Libraries/Components/Touchable/Touchable.js index 82a1293a605..3ec606883e3 100644 --- a/Libraries/Components/Touchable/Touchable.js +++ b/Libraries/Components/Touchable/Touchable.js @@ -933,6 +933,7 @@ const Touchable = { }: { color: string | number, hitSlop: EdgeInsetsProp, + ... }): null | React.Node => { if (!Touchable.TOUCH_TARGET_DEBUG) { return null; diff --git a/Libraries/Components/Touchable/TouchableBounce.js b/Libraries/Components/Touchable/TouchableBounce.js index 1c6e53c5c37..641b7215ef1 100644 --- a/Libraries/Components/Touchable/TouchableBounce.js +++ b/Libraries/Components/Touchable/TouchableBounce.js @@ -32,6 +32,7 @@ import type {PressEvent} from '../../Types/CoreEventTypes'; type State = { animationID: ?number, scale: Animated.Value, + ... }; const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30}; diff --git a/Libraries/Components/Touchable/TouchableNativeFeedback.android.js b/Libraries/Components/Touchable/TouchableNativeFeedback.android.js index ae07343a264..e86d89393c1 100644 --- a/Libraries/Components/Touchable/TouchableNativeFeedback.android.js +++ b/Libraries/Components/Touchable/TouchableNativeFeedback.android.js @@ -166,6 +166,7 @@ const TouchableNativeFeedbackImpl = createReactClass({ SelectableBackground: function(): { type: 'ThemeAttrAndroid', attribute: 'selectableItemBackground', + ... } { return {type: 'ThemeAttrAndroid', attribute: 'selectableItemBackground'}; }, @@ -177,6 +178,7 @@ const TouchableNativeFeedbackImpl = createReactClass({ SelectableBackgroundBorderless: function(): { type: 'ThemeAttrAndroid', attribute: 'selectableItemBackgroundBorderless', + ... } { return { type: 'ThemeAttrAndroid', @@ -200,6 +202,7 @@ const TouchableNativeFeedbackImpl = createReactClass({ type: 'RippleAndroid', color: ?number, borderless: boolean, + ... } { return { type: 'RippleAndroid', diff --git a/Libraries/Components/View/ReactNativeStyleAttributes.js b/Libraries/Components/View/ReactNativeStyleAttributes.js index f80746cd447..ebd3c63df56 100644 --- a/Libraries/Components/View/ReactNativeStyleAttributes.js +++ b/Libraries/Components/View/ReactNativeStyleAttributes.js @@ -52,6 +52,7 @@ type StyleAttributesType = { tintColor: typeof colorAttributes | true, textShadowColor: typeof colorAttributes | true, overlayColor: typeof colorAttributes | true, + ... }; const ReactNativeStyleAttributes: StyleAttributesType = {}; diff --git a/Libraries/Components/View/ViewAccessibility.js b/Libraries/Components/View/ViewAccessibility.js index 38b078056aa..dd2056ae529 100644 --- a/Libraries/Components/View/ViewAccessibility.js +++ b/Libraries/Components/View/ViewAccessibility.js @@ -46,13 +46,12 @@ export type AccessibilityRole = export type AccessibilityActionInfo = $ReadOnly<{ name: string, label?: string, + ... }>; // The info included in the event sent to onAccessibilityAction export type AccessibilityActionEvent = SyntheticEvent< - $ReadOnly<{ - actionName: string, - }>, + $ReadOnly<{actionName: string, ...}>, >; export type AccessibilityState = { @@ -61,6 +60,7 @@ export type AccessibilityState = { checked?: ?boolean | 'mixed', busy?: boolean, expanded?: boolean, + ... }; export type AccessibilityValue = $ReadOnly<{| diff --git a/Libraries/Components/View/ViewNativeComponent.js b/Libraries/Components/View/ViewNativeComponent.js index 2ca2f1d3f58..568f38f7fda 100644 --- a/Libraries/Components/View/ViewNativeComponent.js +++ b/Libraries/Components/View/ViewNativeComponent.js @@ -35,9 +35,11 @@ let viewConfig: captured: string, |}>, |}>, + ..., }>, directEventTypes?: $ReadOnly<{ [eventName: string]: $ReadOnly<{|registrationName: string|}>, + ..., }>, uiViewClassName: string, validAttributes?: { @@ -47,6 +49,7 @@ let viewConfig: diff?: (arg1: any, arg2: any) => boolean, process?: (arg1: any) => any, |}>, + ..., }, |}; diff --git a/Libraries/Core/Devtools/getDevServer.js b/Libraries/Core/Devtools/getDevServer.js index 845640847c8..5f8dfe1fcc2 100644 --- a/Libraries/Core/Devtools/getDevServer.js +++ b/Libraries/Core/Devtools/getDevServer.js @@ -18,6 +18,7 @@ const FALLBACK = 'http://localhost:8081/'; type DevServerInfo = { url: string, bundleLoadedFromServer: boolean, + ... }; /** diff --git a/Libraries/Core/Devtools/parseErrorStack.js b/Libraries/Core/Devtools/parseErrorStack.js index 8d54d46b5c3..b24b0d50cc2 100644 --- a/Libraries/Core/Devtools/parseErrorStack.js +++ b/Libraries/Core/Devtools/parseErrorStack.js @@ -18,6 +18,7 @@ export type ExtendedError = Error & { componentStack?: string, forceRedbox?: boolean, isComponentError?: boolean, + ... }; function parseErrorStack(e: ExtendedError): Array { diff --git a/Libraries/Core/Devtools/symbolicateStackTrace.js b/Libraries/Core/Devtools/symbolicateStackTrace.js index fca52b49d36..26d00d72d76 100644 --- a/Libraries/Core/Devtools/symbolicateStackTrace.js +++ b/Libraries/Core/Devtools/symbolicateStackTrace.js @@ -24,6 +24,7 @@ export type CodeFrame = $ReadOnly<{| location: { row: number, column: number, + ... }, fileName: string, |}>; diff --git a/Libraries/Core/ExceptionsManager.js b/Libraries/Core/ExceptionsManager.js index a3cfd810101..dc759f0b958 100644 --- a/Libraries/Core/ExceptionsManager.js +++ b/Libraries/Core/ExceptionsManager.js @@ -140,6 +140,7 @@ function reportException(e: ExtendedError, isFatal: boolean) { declare var console: typeof console & { _errorOriginal: typeof console.error, reportErrorsAsExceptions: boolean, + ... }; /** diff --git a/Libraries/Core/NativeExceptionsManager.js b/Libraries/Core/NativeExceptionsManager.js index 779fe2db258..20677034c1e 100644 --- a/Libraries/Core/NativeExceptionsManager.js +++ b/Libraries/Core/NativeExceptionsManager.js @@ -31,6 +31,7 @@ export type ExceptionData = { isFatal: boolean, // flowlint-next-line unclear-type:off extraData?: Object, + ... }; export interface Spec extends TurboModule { diff --git a/Libraries/Core/ReactFiberErrorDialog.js b/Libraries/Core/ReactFiberErrorDialog.js index 3ea3b623462..6cd503f8ebc 100644 --- a/Libraries/Core/ReactFiberErrorDialog.js +++ b/Libraries/Core/ReactFiberErrorDialog.js @@ -12,10 +12,11 @@ export type CapturedError = { +componentName: ?string, +componentStack: string, +error: mixed, - +errorBoundary: ?{}, + +errorBoundary: ?{...}, +errorBoundaryFound: boolean, +errorBoundaryName: string | null, +willRetry: boolean, + ... }; import type {ExtendedError} from './Devtools/parseErrorStack'; diff --git a/Libraries/Core/Timers/JSTimers.js b/Libraries/Core/Timers/JSTimers.js index d81c80ad762..feaeddf89a0 100644 --- a/Libraries/Core/Timers/JSTimers.js +++ b/Libraries/Core/Timers/JSTimers.js @@ -58,7 +58,7 @@ const types: Array = []; const timerIDs: Array = []; let immediates: Array = []; let requestIdleCallbacks: Array = []; -const requestIdleCallbackTimeouts: {[number]: number} = {}; +const requestIdleCallbackTimeouts: {[number]: number, ...} = {}; let GUID = 1; let errors: ?Array = null; diff --git a/Libraries/Core/setUpDeveloperTools.js b/Libraries/Core/setUpDeveloperTools.js index 4b0e9815ca9..6fe91a5f0b9 100644 --- a/Libraries/Core/setUpDeveloperTools.js +++ b/Libraries/Core/setUpDeveloperTools.js @@ -12,9 +12,7 @@ import Platform from '../Utilities/Platform'; -declare var console: typeof console & { - _isPolyfilled: boolean, -}; +declare var console: typeof console & {_isPolyfilled: boolean, ...}; /** * Sets up developer tools for React Native. diff --git a/Libraries/Core/setUpSegmentFetcher.js b/Libraries/Core/setUpSegmentFetcher.js index 42561ed2ba1..c31e2cea182 100644 --- a/Libraries/Core/setUpSegmentFetcher.js +++ b/Libraries/Core/setUpSegmentFetcher.js @@ -31,7 +31,13 @@ function __fetchSegment( SegmentFetcher.fetchSegment( segmentId, options, - (errorObject: ?{message: string, code: string}) => { + ( + errorObject: ?{ + message: string, + code: string, + ... + }, + ) => { if (errorObject) { const error = new Error(errorObject.message); (error: any).code = errorObject.code; // flowlint-line unclear-type: off @@ -63,7 +69,14 @@ function __getSegment( SegmentFetcher.getSegment( segmentId, options, - (errorObject: ?{message: string, code: string}, path: ?string) => { + ( + errorObject: ?{ + message: string, + code: string, + ... + }, + path: ?string, + ) => { if (errorObject) { const error = new Error(errorObject.message); (error: any).code = errorObject.code; // flowlint-line unclear-type: off diff --git a/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js b/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js index f4648be20b1..6cf238d42e0 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js @@ -17,6 +17,7 @@ const DeprecatedEdgeInsetsPropType: React$PropType$Primitive<{ left?: number, right?: number, top?: number, + ... }> = PropTypes.shape({ top: PropTypes.number, left: PropTypes.number, diff --git a/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.js b/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.js index b2d41020de7..e01cc42fb26 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.js @@ -30,7 +30,14 @@ module.exports = { }), PropTypes.number, ]): React$PropType$Primitive< - {height?: number, scale?: number, uri?: string, width?: number} | number, + | { + height?: number, + scale?: number, + uri?: string, + width?: number, + ... + } + | number, >), accessible: PropTypes.bool, diff --git a/Libraries/DeprecatedPropTypes/DeprecatedPointPropType.js b/Libraries/DeprecatedPropTypes/DeprecatedPointPropType.js index 1d13e7ed74a..ef60608bd0e 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedPointPropType.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedPointPropType.js @@ -15,6 +15,7 @@ const PropTypes = require('prop-types'); const PointPropType: React$PropType$Primitive<{ x?: number, y?: number, + ... }> = PropTypes.shape({ x: PropTypes.number, y: PropTypes.number, diff --git a/Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.js b/Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.js index 6db04c44912..d8e468359e2 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.js @@ -18,7 +18,11 @@ const DeprecatedShadowPropTypesIOS = { shadowOffset: (ReactPropTypes.shape({ width: ReactPropTypes.number, height: ReactPropTypes.number, - }): React$PropType$Primitive<{height?: number, width?: number}>), + }): React$PropType$Primitive<{ + height?: number, + width?: number, + ... + }>), shadowOpacity: ReactPropTypes.number, shadowRadius: ReactPropTypes.number, }; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedStyleSheetPropType.js b/Libraries/DeprecatedPropTypes/DeprecatedStyleSheetPropType.js index dcab087fb5e..f692187a678 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedStyleSheetPropType.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedStyleSheetPropType.js @@ -15,6 +15,7 @@ const flattenStyle = require('../StyleSheet/flattenStyle'); function DeprecatedStyleSheetPropType(shape: { [key: string]: ReactPropsCheckType, + ..., }): ReactPropsCheckType { const shapePropType = deprecatedCreateStrictShapeTypeChecker(shape); return function(props, propName, componentName, location?, ...rest) { diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js index 8325bd4882e..275d607b948 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js @@ -398,7 +398,11 @@ module.exports = { selection: (PropTypes.shape({ start: PropTypes.number.isRequired, end: PropTypes.number, - }): React$PropType$Primitive<{end?: number, start: number}>), + }): React$PropType$Primitive<{ + end?: number, + start: number, + ... + }>), /** * The value to show for the text input. `TextInput` is a controlled * component, which means the native value will be forced to match this diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js index 428b2d38aab..1c41ff46259 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js @@ -74,7 +74,11 @@ const DeprecatedTextStylePropTypes = { textShadowOffset: (ReactPropTypes.shape({ width: ReactPropTypes.number, height: ReactPropTypes.number, - }): React$PropType$Primitive<{height?: number, width?: number}>), + }): React$PropType$Primitive<{ + height?: number, + width?: number, + ... + }>), textShadowRadius: ReactPropTypes.number, textShadowColor: DeprecatedColorPropType, /** diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTransformPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTransformPropTypes.js index 78b445e754b..daba0d83676 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedTransformPropTypes.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedTransformPropTypes.js @@ -58,18 +58,18 @@ const DeprecatedTransformPropTypes = { ]), ): React$PropType$Primitive< Array< - | {perspective?: number} - | {rotate?: string} - | {rotateX?: string} - | {rotateY?: string} - | {rotateZ?: string} - | {scale?: number} - | {scaleX?: number} - | {scaleY?: number} - | {translateX?: number} - | {translateY?: number} - | {skewX?: string} - | {skewY?: string}, + | {perspective?: number, ...} + | {rotate?: string, ...} + | {rotateX?: string, ...} + | {rotateY?: string, ...} + | {rotateZ?: string, ...} + | {scale?: number, ...} + | {scaleX?: number, ...} + | {scaleY?: number, ...} + | {translateX?: number, ...} + | {translateY?: number, ...} + | {skewX?: string, ...} + | {skewY?: string, ...}, >, >), transformMatrix: TransformMatrixPropType, diff --git a/Libraries/DeprecatedPropTypes/deprecatedCreateStrictShapeTypeChecker.js b/Libraries/DeprecatedPropTypes/deprecatedCreateStrictShapeTypeChecker.js index 382e73432a1..b9249abab95 100644 --- a/Libraries/DeprecatedPropTypes/deprecatedCreateStrictShapeTypeChecker.js +++ b/Libraries/DeprecatedPropTypes/deprecatedCreateStrictShapeTypeChecker.js @@ -14,6 +14,7 @@ const invariant = require('invariant'); function deprecatedCreateStrictShapeTypeChecker(shapeTypes: { [key: string]: ReactPropsCheckType, + ..., }): ReactPropsChainableTypeChecker { function checkType( isRequired, @@ -70,7 +71,7 @@ function deprecatedCreateStrictShapeTypeChecker(shapeTypes: { } } function chainedCheckType( - props: {[key: string]: any}, + props: {[key: string]: any, ...}, propName: string, componentName: string, location?: string, diff --git a/Libraries/EventEmitter/NativeEventEmitter.js b/Libraries/EventEmitter/NativeEventEmitter.js index 6b70ef03df0..59e03aa47d8 100644 --- a/Libraries/EventEmitter/NativeEventEmitter.js +++ b/Libraries/EventEmitter/NativeEventEmitter.js @@ -21,6 +21,7 @@ import type EmitterSubscription from '../vendor/emitter/EmitterSubscription'; type NativeModule = { +addListener: (eventType: string) => void, +removeListeners: (count: number) => void, + ... }; /** diff --git a/Libraries/Experimental/Incremental.js b/Libraries/Experimental/Incremental.js index ba16f91c932..11174c0c833 100644 --- a/Libraries/Experimental/Incremental.js +++ b/Libraries/Experimental/Incremental.js @@ -90,10 +90,9 @@ export type Props = { */ name: string, children: React.Node, + ... }; -type State = { - doIncrementalRender: boolean, -}; +type State = {doIncrementalRender: boolean, ...}; class Incremental extends React.Component { props: Props; @@ -191,7 +190,9 @@ export type Context = { incrementalGroup: ?{ groupId: string, incrementalCount: number, + ... }, + ... }; module.exports = Incremental; diff --git a/Libraries/Experimental/IncrementalExample.js b/Libraries/Experimental/IncrementalExample.js index 4d551053e4f..cf94088afac 100644 --- a/Libraries/Experimental/IncrementalExample.js +++ b/Libraries/Experimental/IncrementalExample.js @@ -36,7 +36,11 @@ let totalWidgets = 0; class SlowWidget extends React.Component< $FlowFixMeProps, - {ctorTimestamp: number, timeToMount: number}, + { + ctorTimestamp: number, + timeToMount: number, + ... + }, > { constructor(props, context) { super(props, context); @@ -92,7 +96,7 @@ function Block(props: Object) { const Row = (props: Object) => ; -class IncrementalExample extends React.Component { +class IncrementalExample extends React.Component { static title: string = ''; static description: string = 'Enables incremental rendering of complex components.'; diff --git a/Libraries/Experimental/IncrementalGroup.js b/Libraries/Experimental/IncrementalGroup.js index 6c2098cea71..53f11d8d06f 100644 --- a/Libraries/Experimental/IncrementalGroup.js +++ b/Libraries/Experimental/IncrementalGroup.js @@ -33,7 +33,9 @@ import type {Props, Context} from './Incremental'; * * See Incremental.js for more info. */ -class IncrementalGroup extends React.Component { +class IncrementalGroup extends React.Component< + Props & {disabled?: boolean, ...}, +> { context: Context; _groupInc: string; UNSAFE_componentWillMount() { diff --git a/Libraries/Image/AssetRegistry.js b/Libraries/Image/AssetRegistry.js index 15ef797c6ee..088187ff3e7 100644 --- a/Libraries/Image/AssetRegistry.js +++ b/Libraries/Image/AssetRegistry.js @@ -20,6 +20,7 @@ export type PackagerAsset = { +hash: string, +name: string, +type: string, + ... }; const assets: Array = []; diff --git a/Libraries/Image/Image.android.js b/Libraries/Image/Image.android.js index 3f4e023185a..fec14e0487f 100644 --- a/Libraries/Image/Image.android.js +++ b/Libraries/Image/Image.android.js @@ -59,13 +59,18 @@ const ImageProps = { }), ), ]): React$PropType$Primitive< - | {headers?: {[string]: string}, uri?: string} + | { + headers?: {[string]: string, ...}, + uri?: string, + ... + } | number | Array<{ - headers?: {[string]: string}, + headers?: {[string]: string, ...}, height?: number, uri?: string, width?: number, + ... }>, >), /** @@ -87,7 +92,7 @@ const ImageProps = { }), // Opaque type returned by require('./image.jpg') PropTypes.number, - ]): React$PropType$Primitive<{uri?: string} | number>), + ]): React$PropType$Primitive<{uri?: string, ...} | number>), progressiveRenderingEnabled: PropTypes.bool, fadeDuration: PropTypes.number, /** @@ -168,7 +173,7 @@ function getSize( */ function getSizeWithHeaders( url: string, - headers: {[string]: string}, + headers: {[string]: string, ...}, success: (width: number, height: number) => void, failure?: (error: any) => void, ): any { @@ -201,7 +206,7 @@ function abortPrefetch(requestId: number) { */ async function queryCache( urls: Array, -): Promise<{[string]: 'memory' | 'disk' | 'disk/memory'}> { +): Promise<{[string]: 'memory' | 'disk' | 'disk/memory', ...}> { return await NativeImageLoaderAndroid.queryCache(urls); } diff --git a/Libraries/Image/Image.ios.js b/Libraries/Image/Image.ios.js index cfc14ae5e8f..5cd788918f7 100644 --- a/Libraries/Image/Image.ios.js +++ b/Libraries/Image/Image.ios.js @@ -42,7 +42,7 @@ function getSize( function getSizeWithHeaders( uri: string, - headers: {[string]: string}, + headers: {[string]: string, ...}, success: (width: number, height: number) => void, failure?: (error: any) => void, ): any { @@ -64,7 +64,7 @@ function prefetch(url: string): any { async function queryCache( urls: Array, -): Promise<{[string]: 'memory' | 'disk' | 'disk/memory'}> { +): Promise<{[string]: 'memory' | 'disk' | 'disk/memory', ...}> { return await NativeImageLoaderIOS.queryCache(urls); } diff --git a/Libraries/Image/ImageSource.js b/Libraries/Image/ImageSource.js index 2a247513448..e2f280f66a0 100644 --- a/Libraries/Image/ImageSource.js +++ b/Libraries/Image/ImageSource.js @@ -23,32 +23,27 @@ export type ImageURISource = $ReadOnly<{ * function). */ uri?: ?string, - /** * `bundle` is the iOS asset bundle which the image is included in. This * will default to [NSBundle mainBundle] if not set. * @platform ios */ bundle?: ?string, - /** * `method` is the HTTP Method to use. Defaults to GET if not specified. */ method?: ?string, - /** * `headers` is an object representing the HTTP headers to send along with the * request for a remote image. */ headers?: ?Object, - /** * `body` is the HTTP body to send with the request. This must be a valid * UTF-8 string, and will be sent exactly as specified, with no * additional encoding (e.g. URL-escaping or base64) applied. */ body?: ?string, - /** * `cache` determines how the requests handles potentially cached * responses. @@ -70,19 +65,18 @@ export type ImageURISource = $ReadOnly<{ * @platform ios */ cache?: ?('default' | 'reload' | 'force-cache' | 'only-if-cached'), - /** * `width` and `height` can be specified if known at build time, in which case * these will be used to set the default `` component dimensions. */ width?: ?number, height?: ?number, - /** * `scale` is used to indicate the scale factor of the image. Defaults to 1.0 if * unspecified, meaning that one image pixel equates to one display point / DIP. */ scale?: ?number, + ... }>; // We have to export any because of an issue in Flow with objects that come from Relay: diff --git a/Libraries/Image/ImageViewNativeComponent.js b/Libraries/Image/ImageViewNativeComponent.js index 27618567bc8..a2f9bd58767 100644 --- a/Libraries/Image/ImageViewNativeComponent.js +++ b/Libraries/Image/ImageViewNativeComponent.js @@ -33,7 +33,7 @@ type NativeProps = $ReadOnly<{| // Android native props shouldNotifyLoadEvents?: boolean, - src?: ?ResolvedAssetSource | $ReadOnlyArray<{uri: string}>, + src?: ?ResolvedAssetSource | $ReadOnlyArray<{uri: string, ...}>, headers?: ?string, defaultSrc?: ?string, loadingIndicatorSrc?: ?string, diff --git a/Libraries/Image/NativeImageLoaderAndroid.js b/Libraries/Image/NativeImageLoaderAndroid.js index cd14b8cfa29..5fc3d2709ac 100644 --- a/Libraries/Image/NativeImageLoaderAndroid.js +++ b/Libraries/Image/NativeImageLoaderAndroid.js @@ -18,11 +18,21 @@ export interface Spec extends TurboModule { +getConstants: () => {||}; +getSize: ( uri: string, - ) => Promise<$ReadOnly<{width: number, height: number}>>; + ) => Promise< + $ReadOnly<{ + width: number, + height: number, + ... + }>, + >; +getSizeWithHeaders: ( uri: string, headers: Object, - ) => Promise<{width: number, height: number}>; + ) => Promise<{ + width: number, + height: number, + ... + }>; +prefetchImage: (uri: string, requestId: number) => Promise; +queryCache: (uris: Array) => Promise; } diff --git a/Libraries/Image/NativeImageLoaderIOS.js b/Libraries/Image/NativeImageLoaderIOS.js index e11c9d5507a..842294d0af2 100644 --- a/Libraries/Image/NativeImageLoaderIOS.js +++ b/Libraries/Image/NativeImageLoaderIOS.js @@ -20,7 +20,11 @@ export interface Spec extends TurboModule { +getSizeWithHeaders: ( uri: string, headers: Object, - ) => Promise<{width: number, height: number}>; + ) => Promise<{ + width: number, + height: number, + ... + }>; +prefetchImage: (uri: string) => Promise; +queryCache: (uris: Array) => Promise; } diff --git a/Libraries/Inspector/ElementBox.js b/Libraries/Inspector/ElementBox.js index 2e67b18f772..07684d2204d 100644 --- a/Libraries/Inspector/ElementBox.js +++ b/Libraries/Inspector/ElementBox.js @@ -92,6 +92,7 @@ type Style = { right: number, bottom: number, left: number, + ... }; /** diff --git a/Libraries/Inspector/ElementProperties.js b/Libraries/Inspector/ElementProperties.js index 31f74406a9e..48a7ff491b6 100644 --- a/Libraries/Inspector/ElementProperties.js +++ b/Libraries/Inspector/ElementProperties.js @@ -31,6 +31,7 @@ type Props = $ReadOnly<{| source?: ?{ fileName?: string, lineNumber?: number, + ... }, frame?: ?Object, selection?: ?number, diff --git a/Libraries/Inspector/Inspector.js b/Libraries/Inspector/Inspector.js index 1100100964b..a68160ad86d 100644 --- a/Libraries/Inspector/Inspector.js +++ b/Libraries/Inspector/Inspector.js @@ -25,6 +25,7 @@ const invariant = require('invariant'); export type ReactRenderer = { getInspectorDataForViewTag: (viewTag: number) => Object, + ... }; const hook = window.__REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -68,6 +69,7 @@ class Inspector extends React.Component< { inspectedViewTag: ?number, onRequestRerenderApp: (callback: (tag: ?number) => void) => void, + ... }, { devtoolsAgent: ?Object, @@ -79,6 +81,7 @@ class Inspector extends React.Component< inspected: any, inspectedViewTag: any, networking: boolean, + ... }, > { _hideTimeoutID: TimeoutID | null = null; diff --git a/Libraries/Inspector/NetworkOverlay.js b/Libraries/Inspector/NetworkOverlay.js index b2956a07761..45e6bdadcbf 100644 --- a/Libraries/Inspector/NetworkOverlay.js +++ b/Libraries/Inspector/NetworkOverlay.js @@ -44,6 +44,7 @@ type NetworkRequestInfo = { messages?: string, serverClose?: Object, serverError?: Object, + ... }; type Props = $ReadOnly<{||}>; @@ -101,7 +102,7 @@ class NetworkOverlay extends React.Component { // Map of `socketId` -> `index in `this.state.requests`. _socketIdMap = {}; // Map of `xhr._index` -> `index in `this.state.requests`. - _xhrIdMap: {[key: number]: number} = {}; + _xhrIdMap: {[key: number]: number, ...} = {}; state: State = { detailRowId: null, diff --git a/Libraries/Inspector/PerformanceOverlay.js b/Libraries/Inspector/PerformanceOverlay.js index 56b86fb16c5..a7307bda917 100644 --- a/Libraries/Inspector/PerformanceOverlay.js +++ b/Libraries/Inspector/PerformanceOverlay.js @@ -16,7 +16,7 @@ const StyleSheet = require('../StyleSheet/StyleSheet'); const Text = require('../Text/Text'); const View = require('../Components/View/View'); -class PerformanceOverlay extends React.Component<{}> { +class PerformanceOverlay extends React.Component<{...}> { render(): React.Node { const perfLogs = PerformanceLogger.getTimespans(); const items = []; diff --git a/Libraries/Interaction/Batchinator.js b/Libraries/Interaction/Batchinator.js index f7f1b2afa7a..5193c40d335 100644 --- a/Libraries/Interaction/Batchinator.js +++ b/Libraries/Interaction/Batchinator.js @@ -37,7 +37,7 @@ const InteractionManager = require('./InteractionManager'); class Batchinator { _callback: () => void; _delay: number; - _taskHandle: ?{cancel: () => void}; + _taskHandle: ?{cancel: () => void, ...}; constructor(callback: () => void, delayMS: number) { this._delay = delayMS; this._callback = callback; @@ -48,7 +48,7 @@ class Batchinator { * By default, if there is a pending task the callback is run immediately. Set the option abort to * true to not call the callback if it was pending. */ - dispose(options: {abort: boolean} = {abort: false}) { + dispose(options: {abort: boolean, ...} = {abort: false}) { if (this._taskHandle) { this._taskHandle.cancel(); if (!options.abort) { diff --git a/Libraries/Interaction/FrameRateLogger.js b/Libraries/Interaction/FrameRateLogger.js index 73a59454346..434e962b027 100644 --- a/Libraries/Interaction/FrameRateLogger.js +++ b/Libraries/Interaction/FrameRateLogger.js @@ -38,6 +38,7 @@ const FrameRateLogger = { setGlobalOptions: function(options: { debug?: boolean, reportStackTraces?: boolean, + ... }) { if (options.debug !== undefined) { invariant( diff --git a/Libraries/Interaction/InteractionManager.js b/Libraries/Interaction/InteractionManager.js index 8784d9bce53..02912bbc3cf 100644 --- a/Libraries/Interaction/InteractionManager.js +++ b/Libraries/Interaction/InteractionManager.js @@ -87,7 +87,12 @@ const InteractionManager = { */ runAfterInteractions( task: ?Task, - ): {then: Function, done: Function, cancel: Function} { + ): { + then: Function, + done: Function, + cancel: Function, + ... + } { const tasks = []; const promise = new Promise(resolve => { _scheduleUpdate(); diff --git a/Libraries/Interaction/InteractionStallDebugger.js b/Libraries/Interaction/InteractionStallDebugger.js index 7facffb1782..78c6bc4258a 100644 --- a/Libraries/Interaction/InteractionStallDebugger.js +++ b/Libraries/Interaction/InteractionStallDebugger.js @@ -14,7 +14,7 @@ const BridgeSpyStallHandler = require('./BridgeSpyStallHandler'); const JSEventLoopWatchdog = require('./JSEventLoopWatchdog'); const InteractionStallDebugger = { - install(options: {thresholdMS: number}): void { + install(options: {thresholdMS: number, ...}): void { JSEventLoopWatchdog.install(options); BridgeSpyStallHandler.register(); }, diff --git a/Libraries/Interaction/JSEventLoopWatchdog.js b/Libraries/Interaction/JSEventLoopWatchdog.js index f8f4e450455..c2787f188fd 100644 --- a/Libraries/Interaction/JSEventLoopWatchdog.js +++ b/Libraries/Interaction/JSEventLoopWatchdog.js @@ -15,7 +15,12 @@ const performanceNow = require('fbjs/lib/performanceNow'); type Handler = { onIterate?: () => void, - onStall: (params: {lastInterval: number, busyTime: number}) => ?string, + onStall: (params: { + lastInterval: number, + busyTime: number, + ... + }) => ?string, + ... }; /** @@ -44,7 +49,7 @@ const JSEventLoopWatchdog = { addHandler: function(handler: Handler) { handlers.push(handler); }, - install: function({thresholdMS}: {thresholdMS: number}) { + install: function({thresholdMS}: {thresholdMS: number, ...}) { acceptableBusyTime = thresholdMS; if (installed) { return; diff --git a/Libraries/Interaction/PanResponder.js b/Libraries/Interaction/PanResponder.js index d70797df24c..1aaf9fce9ec 100644 --- a/Libraries/Interaction/PanResponder.js +++ b/Libraries/Interaction/PanResponder.js @@ -559,7 +559,7 @@ const PanResponder = { }; function clearInteractionHandle( - interactionState: {handle: ?number}, + interactionState: {handle: ?number, ...}, callback: ?(ActiveCallback | PassiveCallback), event: PressEvent, gestureState: GestureState, diff --git a/Libraries/Interaction/TaskQueue.js b/Libraries/Interaction/TaskQueue.js index 17332b5821e..bf15d06a090 100644 --- a/Libraries/Interaction/TaskQueue.js +++ b/Libraries/Interaction/TaskQueue.js @@ -16,10 +16,12 @@ const invariant = require('invariant'); type SimpleTask = { name: string, run: () => void, + ... }; type PromiseTask = { name: string, gen: () => Promise, + ... }; export type Task = Function | SimpleTask | PromiseTask; @@ -49,7 +51,7 @@ class TaskQueue { * `onMoreTasks` is invoked when `PromiseTask`s resolve if there are more * tasks to process. */ - constructor({onMoreTasks}: {onMoreTasks: () => void}) { + constructor({onMoreTasks}: {onMoreTasks: () => void, ...}) { this._onMoreTasks = onMoreTasks; this._queueStack = [{tasks: [], popable: false}]; } @@ -122,7 +124,11 @@ class TaskQueue { } } - _queueStack: Array<{tasks: Array, popable: boolean}>; + _queueStack: Array<{ + tasks: Array, + popable: boolean, + ... + }>; _onMoreTasks: () => void; _getCurrentQueue(): Array { diff --git a/Libraries/JSInspector/JSInspector.js b/Libraries/JSInspector/JSInspector.js index 5cb7b612f00..44917ac36b1 100644 --- a/Libraries/JSInspector/JSInspector.js +++ b/Libraries/JSInspector/JSInspector.js @@ -17,7 +17,7 @@ interface Agent { } // Flow doesn't support static declarations in interface -type AgentClass = Class & {DOMAIN: string}; +type AgentClass = Class & {DOMAIN: string, ...}; declare function __registerInspectorAgent(type: AgentClass): void; declare function __inspectorTimestamp(): number; diff --git a/Libraries/JSInspector/NetworkAgent.js b/Libraries/JSInspector/NetworkAgent.js index 4ad89bae6af..9f48f7cb1f2 100644 --- a/Libraries/JSInspector/NetworkAgent.js +++ b/Libraries/JSInspector/NetworkAgent.js @@ -64,6 +64,7 @@ type Initiator = { stackTrace?: StackTrace, url?: string, lineNumber?: number, + ... }; type ResourcePriority = 'VeryLow' | 'Low' | 'Medium' | 'High' | 'VeryHigh'; @@ -75,6 +76,7 @@ type Request = { postData?: string, mixedContentType?: 'blockable' | 'optionally-blockable' | 'none', initialPriority: ResourcePriority, + ... }; type Response = { @@ -92,6 +94,7 @@ type Response = { encodedDataLength: number, timing?: ResourceTiming, securityState: SecurityState, + ... }; type RequestWillBeSentEvent = { @@ -106,6 +109,7 @@ type RequestWillBeSentEvent = { // This is supposed to be optional but the inspector crashes without it, // see https://bugs.chromium.org/p/chromium/issues/detail?id=653138 type: ResourceType, + ... }; type ResponseReceivedEvent = { @@ -115,6 +119,7 @@ type ResponseReceivedEvent = { timestamp: Timestamp, type: ResourceType, response: Response, + ... }; type DataReceived = { @@ -122,12 +127,14 @@ type DataReceived = { timestamp: Timestamp, dataLength: number, encodedDataLength: number, + ... }; type LoadingFinishedEvent = { requestId: RequestId, timestamp: Timestamp, encodedDataLength: number, + ... }; type LoadingFailedEvent = { @@ -137,6 +144,7 @@ type LoadingFailedEvent = { errorText: string, canceled?: boolean, blockedReason?: BlockedReason, + ... }; class Interceptor { @@ -248,6 +256,7 @@ class Interceptor { type EnableArgs = { maxResourceBufferSize?: number, maxTotalBufferSize?: number, + ... }; class NetworkAgent extends InspectorAgent { @@ -270,7 +279,12 @@ class NetworkAgent extends InspectorAgent { requestId, }: { requestId: RequestId, - }): {body: ?string, base64Encoded: boolean} { + ... + }): { + body: ?string, + base64Encoded: boolean, + ... + } { return {body: this.interceptor().getData(requestId), base64Encoded: false}; } diff --git a/Libraries/Linking/Linking.js b/Libraries/Linking/Linking.js index 284f2336a5b..8c7dfa9b0c0 100644 --- a/Libraries/Linking/Linking.js +++ b/Libraries/Linking/Linking.js @@ -100,7 +100,11 @@ class Linking extends NativeEventEmitter { */ sendIntent( action: string, - extras?: Array<{key: string, value: string | number | boolean}>, + extras?: Array<{ + key: string, + value: string | number | boolean, + ... + }>, ): Promise { if (Platform.OS === 'android') { return NativeLinking.sendIntent(action, extras); diff --git a/Libraries/Linking/NativeLinking.js b/Libraries/Linking/NativeLinking.js index cbb7c1a00bd..b5bc6d8f17c 100644 --- a/Libraries/Linking/NativeLinking.js +++ b/Libraries/Linking/NativeLinking.js @@ -24,7 +24,11 @@ export interface Spec extends TurboModule { // Android only +sendIntent: ( action: string, - extras: ?Array<{key: string, value: string | number | boolean}>, + extras: ?Array<{ + key: string, + value: string | number | boolean, + ... + }>, ) => Promise; // Events diff --git a/Libraries/Lists/FillRateHelper.js b/Libraries/Lists/FillRateHelper.js index a6c95003d6c..a1d58669c48 100644 --- a/Libraries/Lists/FillRateHelper.js +++ b/Libraries/Lists/FillRateHelper.js @@ -28,7 +28,12 @@ class Info { sample_count: number = 0; } -type FrameMetrics = {inLayout?: boolean, length: number, offset: number}; +type FrameMetrics = { + inLayout?: boolean, + length: number, + offset: number, + ... +}; const DEBUG = false; @@ -52,7 +57,9 @@ class FillRateHelper { _mostlyBlankStartTime = (null: ?number); _samplesStartTime = (null: ?number); - static addListener(callback: FillRateInfo => void): {remove: () => void} { + static addListener( + callback: FillRateInfo => void, + ): {remove: () => void, ...} { warning( _sampleRate !== null, 'Call `FillRateHelper.setSampleRate` before `addListener`.', @@ -133,16 +140,19 @@ class FillRateHelper { data: any, getItemCount: (data: any) => number, initialNumToRender: number, + ... }, state: { first: number, last: number, + ... }, scrollMetrics: { dOffset: number, offset: number, velocity: number, visibleLength: number, + ... }, ): number { if ( diff --git a/Libraries/Lists/FlatList.js b/Libraries/Lists/FlatList.js index a55deaaa030..3ede56e8266 100644 --- a/Libraries/Lists/FlatList.js +++ b/Libraries/Lists/FlatList.js @@ -89,7 +89,12 @@ type OptionalProps = {| getItemLayout?: ( data: ?Array, index: number, - ) => {length: number, offset: number, index: number}, + ) => { + length: number, + offset: number, + index: number, + ... + }, /** * If true, renders items next to each other horizontally instead of stacked vertically. */ @@ -144,9 +149,11 @@ export type Props = { getItemLayout: $PropertyType, renderItem: $PropertyType, keyExtractor: $PropertyType, + ... }, >, ...FlatListProps, + ... }; const defaultProps = { @@ -275,7 +282,7 @@ class FlatList extends React.PureComponent, void> { /** * Scrolls to the end of the content. May be janky without `getItemLayout` prop. */ - scrollToEnd(params?: ?{animated?: ?boolean}) { + scrollToEnd(params?: ?{animated?: ?boolean, ...}) { if (this._listRef) { this._listRef.scrollToEnd(params); } @@ -294,6 +301,7 @@ class FlatList extends React.PureComponent, void> { index: number, viewOffset?: number, viewPosition?: number, + ... }) { if (this._listRef) { this._listRef.scrollToIndex(params); @@ -310,6 +318,7 @@ class FlatList extends React.PureComponent, void> { animated?: ?boolean, item: ItemT, viewPosition?: number, + ... }) { if (this._listRef) { this._listRef.scrollToItem(params); @@ -321,7 +330,7 @@ class FlatList extends React.PureComponent, void> { * * Check out [scrollToOffset](docs/virtualizedlist.html#scrolltooffset) of VirtualizedList */ - scrollToOffset(params: {animated?: ?boolean, offset: number}) { + scrollToOffset(params: {animated?: ?boolean, offset: number, ...}) { if (this._listRef) { this._listRef.scrollToOffset(params); } @@ -364,7 +373,7 @@ class FlatList extends React.PureComponent, void> { } } - setNativeProps(props: {[string]: mixed}) { + setNativeProps(props: {[string]: mixed, ...}) { if (this._listRef) { this._listRef.setNativeProps(props); } @@ -512,11 +521,13 @@ class FlatList extends React.PureComponent, void> { onViewableItemsChanged: ?(info: { viewableItems: Array, changed: Array, + ... }) => void, ) { return (info: { viewableItems: Array, changed: Array, + ... }) => { const {numColumns} = this.props; if (onViewableItemsChanged) { diff --git a/Libraries/Lists/SectionList.js b/Libraries/Lists/SectionList.js index cae14ff81df..52da28685c1 100644 --- a/Libraries/Lists/SectionList.js +++ b/Libraries/Lists/SectionList.js @@ -52,7 +52,9 @@ type OptionalProps> = {| highlight: () => void, unhighlight: () => void, updateProps: (select: 'leading' | 'trailing', newProps: Object) => void, + ... }, + ... }) => null | React.Element, /** * A marker property for telling the list to re-render (since it implements `PureComponent`). If @@ -81,7 +83,7 @@ type OptionalProps> = {| * Called once when the scroll position gets within `onEndReachedThreshold` of the rendered * content. */ - onEndReached?: ?(info: {distanceFromEnd: number}) => void, + onEndReached?: ?(info: {distanceFromEnd: number, ...}) => void, /** * Note: may have bugs (missing content) in some circumstances - use at your own risk. * @@ -103,6 +105,7 @@ export type Props = {| VirtualizedSectionListProps, 'renderItem', >, + ... }, >, ...RequiredProps, diff --git a/Libraries/Lists/ViewabilityHelper.js b/Libraries/Lists/ViewabilityHelper.js index bffa859c202..1ea6b880dad 100644 --- a/Libraries/Lists/ViewabilityHelper.js +++ b/Libraries/Lists/ViewabilityHelper.js @@ -18,6 +18,7 @@ export type ViewToken = { index: ?number, isViewable: boolean, section?: any, + ... }; export type ViewabilityConfigCallbackPair = { @@ -25,7 +26,9 @@ export type ViewabilityConfigCallbackPair = { onViewableItemsChanged: (info: { viewableItems: Array, changed: Array, + ... }) => void, + ... }; export type ViewabilityConfig = {| @@ -99,8 +102,19 @@ class ViewabilityHelper { itemCount: number, scrollOffset: number, viewportHeight: number, - getFrameMetrics: (index: number) => ?{length: number, offset: number}, - renderRange?: {first: number, last: number}, // Optional optimization to reduce the scan size + getFrameMetrics: ( + index: number, + ) => ?{ + length: number, + offset: number, + ... + }, + // Optional optimization to reduce the scan size + renderRange?: { + first: number, + last: number, + ... + }, ): Array { const { itemVisiblePercentThreshold, @@ -165,13 +179,25 @@ class ViewabilityHelper { itemCount: number, scrollOffset: number, viewportHeight: number, - getFrameMetrics: (index: number) => ?{length: number, offset: number}, + getFrameMetrics: ( + index: number, + ) => ?{ + length: number, + offset: number, + ... + }, createViewToken: (index: number, isViewable: boolean) => ViewToken, onViewableItemsChanged: ({ viewableItems: Array, changed: Array, + ... }) => void, - renderRange?: {first: number, last: number}, // Optional optimization to reduce the scan size + // Optional optimization to reduce the scan size + renderRange?: { + first: number, + last: number, + ... + }, ): void { if ( (this._config.waitForInteraction && !this._hasInteracted) || diff --git a/Libraries/Lists/VirtualizeUtils.js b/Libraries/Lists/VirtualizeUtils.js index ef546940a60..2d4c8ae8c60 100644 --- a/Libraries/Lists/VirtualizeUtils.js +++ b/Libraries/Lists/VirtualizeUtils.js @@ -20,7 +20,13 @@ const invariant = require('invariant'); function elementsThatOverlapOffsets( offsets: Array, itemCount: number, - getFrameMetrics: (index: number) => {length: number, offset: number}, + getFrameMetrics: ( + index: number, + ) => { + length: number, + offset: number, + ... + }, ): Array { const out = []; let outLength = 0; @@ -52,8 +58,16 @@ function elementsThatOverlapOffsets( * faster. */ function newRangeCount( - prev: {first: number, last: number}, - next: {first: number, last: number}, + prev: { + first: number, + last: number, + ... + }, + next: { + first: number, + last: number, + ... + }, ): number { return ( next.last - @@ -78,16 +92,32 @@ function computeWindowedRenderLimits( getItemCount: (data: any) => number, maxToRenderPerBatch: number, windowSize: number, + ... + }, + prev: { + first: number, + last: number, + ... + }, + getFrameMetricsApprox: ( + index: number, + ) => { + length: number, + offset: number, + ... }, - prev: {first: number, last: number}, - getFrameMetricsApprox: (index: number) => {length: number, offset: number}, scrollMetrics: { dt: number, offset: number, velocity: number, visibleLength: number, + ... }, -): {first: number, last: number} { +): { + first: number, + last: number, + ... +} { const {data, getItemCount, maxToRenderPerBatch, windowSize} = props; const itemCount = getItemCount(data); if (itemCount === 0) { diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index b62c81ad371..927849b102d 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -42,12 +42,14 @@ export type Separators = { highlight: () => void, unhighlight: () => void, updateProps: (select: 'leading' | 'trailing', newProps: Object) => void, + ... }; export type RenderItemProps = { item: ItemT, index: number, separators: Separators, + ... }; export type RenderItemType = ( @@ -59,7 +61,9 @@ type ViewabilityHelperCallbackTuple = { onViewableItemsChanged: (info: { viewableItems: Array, changed: Array, + ... }) => void, + ... }; type RequiredProps = {| @@ -96,10 +100,16 @@ type OptionalProps = {| * `data` prop, stick it here and treat it immutably. */ extraData?: any, + // e.g. height, y getItemLayout?: ( data: any, index: number, - ) => {length: number, offset: number, index: number}, // e.g. height, y + ) => { + length: number, + offset: number, + index: number, + ... + }, horizontal?: ?boolean, /** * How many items to render in the initial batch. This should be enough to fill the screen but not @@ -197,7 +207,7 @@ type OptionalProps = {| * Called once when the scroll position gets within `onEndReachedThreshold` of the rendered * content. */ - onEndReached?: ?(info: {distanceFromEnd: number}) => void, + onEndReached?: ?(info: {distanceFromEnd: number, ...}) => void, /** * How far from the end (in units of visible length of the list) the bottom edge of the * list must be from the end of the content to trigger the `onEndReached` callback. @@ -219,6 +229,7 @@ type OptionalProps = {| index: number, highestMeasuredFrameIndex: number, averageItemLength: number, + ... }) => void, /** * Called when the viewability of rows changes, as defined by the @@ -227,6 +238,7 @@ type OptionalProps = {| onViewableItemsChanged?: ?(info: { viewableItems: Array, changed: Array, + ... }) => void, persistentScrollbar?: ?boolean, /** @@ -308,15 +320,21 @@ type Frame = { length: number, index: number, inLayout: boolean, + ... }; type ChildListState = { first: number, last: number, - frames: {[key: number]: Frame}, + frames: {[key: number]: Frame, ...}, + ... }; -type State = {first: number, last: number}; +type State = { + first: number, + last: number, + ... +}; /** * Base implementation for the more convenient [``](/react-native/docs/flatlist.html) @@ -350,7 +368,7 @@ class VirtualizedList extends React.PureComponent { props: Props; // scrollToEnd may be janky without getItemLayout prop - scrollToEnd(params?: ?{animated?: ?boolean}) { + scrollToEnd(params?: ?{animated?: ?boolean, ...}) { const animated = params ? params.animated : true; const veryLast = this.props.getItemCount(this.props.data) - 1; const frame = this._getFrameMetricsApprox(veryLast); @@ -377,6 +395,7 @@ class VirtualizedList extends React.PureComponent { index: number, viewOffset?: number, viewPosition?: number, + ... }) { const { data, @@ -429,6 +448,7 @@ class VirtualizedList extends React.PureComponent { animated?: ?boolean, item: Item, viewPosition?: number, + ... }) { const {item} = params; const {data, getItem, getItemCount} = this.props; @@ -451,7 +471,7 @@ class VirtualizedList extends React.PureComponent { * Param `animated` (`true` by default) defines whether the list * should do an animation while scrolling. */ - scrollToOffset(params: {animated?: ?boolean, offset: number}) { + scrollToOffset(params: {animated?: ?boolean, offset: number, ...}) { const {animated, offset} = params; if (this._scrollRef == null) { @@ -596,6 +616,7 @@ class VirtualizedList extends React.PureComponent { timestamp: number, velocity: number, visibleLength: number, + ... }, horizontal: ?boolean, getOutermostParentListRef: Function, @@ -604,11 +625,14 @@ class VirtualizedList extends React.PureComponent { cellKey: string, key: string, ref: VirtualizedList, + ... }) => ?ChildListState, unregisterAsNestedChild: ({ key: string, state: ChildListState, + ... }) => void, + ... }, |} { return { @@ -655,6 +679,7 @@ class VirtualizedList extends React.PureComponent { cellKey: string, key: string, ref: VirtualizedList, + ... }): ?ChildListState => { // Register the mapping between this child key and the cellKey for its cell const childListsInCell = @@ -683,6 +708,7 @@ class VirtualizedList extends React.PureComponent { _unregisterAsNestedChild = (childList: { key: string, state: ChildListState, + ... }): void => { this._nestedChildLists.set(childList.key, { ref: null, @@ -1182,7 +1208,11 @@ class VirtualizedList extends React.PureComponent { _indicesToKeys: Map = new Map(); _nestedChildLists: Map< string, - {ref: ?VirtualizedList, state: ?ChildListState}, + { + ref: ?VirtualizedList, + state: ?ChildListState, + ... + }, > = new Map(); _offsetFromParentVirtualizedList: number = 0; _prevParentOffset: number = 0; @@ -1430,11 +1460,23 @@ class VirtualizedList extends React.PureComponent { ); } - _selectLength(metrics: $ReadOnly<{height: number, width: number}>): number { + _selectLength( + metrics: $ReadOnly<{ + height: number, + width: number, + ... + }>, + ): number { return !this.props.horizontal ? metrics.height : metrics.width; } - _selectOffset(metrics: $ReadOnly<{x: number, y: number}>): number { + _selectOffset( + metrics: $ReadOnly<{ + x: number, + y: number, + ... + }>, + ): number { return !this.props.horizontal ? metrics.y : metrics.x; } @@ -1492,6 +1534,7 @@ class VirtualizedList extends React.PureComponent { _convertParentScrollMetrics = (metrics: { visibleLength: number, offset: number, + ... }) => { // Offset of the top of the nested list relative to the top of its parent's viewport const offset = metrics.offset - this._offsetFromParentVirtualizedList; @@ -1739,7 +1782,11 @@ class VirtualizedList extends React.PureComponent { _getFrameMetricsApprox = ( index: number, - ): {length: number, offset: number} => { + ): { + length: number, + offset: number, + ... + } => { const frame = this._getFrameMetrics(index); if (frame && frame.index === index) { // check for invalid frames due to row re-ordering @@ -1764,6 +1811,7 @@ class VirtualizedList extends React.PureComponent { offset: number, index: number, inLayout?: boolean, + ... } => { const { data, @@ -1828,18 +1876,27 @@ type CellRendererProps = { index: number, inversionStyle: ViewStyleProp, item: Item, - onLayout: (event: Object) => void, // This is extracted by ScrollViewStickyHeader + // This is extracted by ScrollViewStickyHeader + onLayout: (event: Object) => void, onUnmount: (cellKey: string) => void, onUpdateSeparators: (cellKeys: Array, props: Object) => void, parentProps: { + // e.g. height, y, getItemLayout?: ( data: any, index: number, - ) => {length: number, offset: number, index: number}, // e.g. height, y, + ) => { + length: number, + offset: number, + index: number, + ... + }, renderItem?: ?RenderItemType, ListItemComponent?: ?(React.ComponentType | React.Element), + ... }, prevCellKey: ?string, + ... }; type CellRendererState = { @@ -1847,6 +1904,7 @@ type CellRendererState = { highlighted: boolean, leadingItem: ?Item, |}>, + ... }; class CellRenderer extends React.Component< @@ -2017,6 +2075,7 @@ class CellRenderer extends React.Component< class VirtualizedCellWrapper extends React.Component<{ cellKey: string, children: React.Node, + ... }> { static childContextTypes = { virtualizedCell: PropTypes.shape({ diff --git a/Libraries/Lists/VirtualizedSectionList.js b/Libraries/Lists/VirtualizedSectionList.js index 83d078b1938..53eb54be609 100644 --- a/Libraries/Lists/VirtualizedSectionList.js +++ b/Libraries/Lists/VirtualizedSectionList.js @@ -30,7 +30,6 @@ export type SectionBase = { * the array index will be used by default. */ key?: string, - // Optional props will override list-wide props just for this section. renderItem?: ?(info: { item: SectionItemT, @@ -40,10 +39,13 @@ export type SectionBase = { highlight: () => void, unhighlight: () => void, updateProps: (select: 'leading' | 'trailing', newProps: Object) => void, + ... }, + ... }) => null | React.Element, ItemSeparatorComponent?: ?React.ComponentType, keyExtractor?: (item: SectionItemT, index?: ?number) => string, + ... }; type RequiredProps> = {| @@ -62,7 +64,9 @@ type OptionalProps> = {| highlight: () => void, unhighlight: () => void, updateProps: (select: 'leading' | 'trailing', newProps: Object) => void, + ... }, + ... }) => null | React.Element, /** * Rendered at the top of each section. These stick to the top of the `ScrollView` by default on @@ -70,12 +74,14 @@ type OptionalProps> = {| */ renderSectionHeader?: ?(info: { section: SectionT, + ... }) => null | React.Element, /** * Rendered at the bottom of each section. */ renderSectionFooter?: ?(info: { section: SectionT, + ... }) => null | React.Element, /** * Rendered at the top and bottom of each section (note this is different from @@ -90,7 +96,7 @@ type OptionalProps> = {| * enabled by default on iOS because that is the platform standard there. */ stickySectionHeadersEnabled?: boolean, - onEndReached?: ?({distanceFromEnd: number}) => void, + onEndReached?: ?({distanceFromEnd: number, ...}) => void, |}; type VirtualizedListProps = React.ElementProps; @@ -100,9 +106,7 @@ export type Props = {| ...OptionalProps, ...$Diff< VirtualizedListProps, - { - renderItem: $PropertyType, - }, + {renderItem: $PropertyType, ...}, >, |}; export type ScrollToLocationParamsType = {| @@ -118,7 +122,7 @@ type DefaultProps = {| data: $ReadOnlyArray, |}; -type State = {childProps: VirtualizedListProps}; +type State = {childProps: VirtualizedListProps, ...}; /** * Right now this just flattens everything into one list and uses VirtualizedList under the @@ -250,13 +254,17 @@ class VirtualizedSectionList< index: number, ): ?{ section: SectionT, - key: string, // Key of the section or combined key for section + item - index: ?number, // Relative index within the section - header?: ?boolean, // True if this is the section header + // Key of the section or combined key for section + item + key: string, + // Relative index within the section + index: ?number, + // True if this is the section header + header?: ?boolean, leadingItem?: ?Item, leadingSection?: ?SectionT, trailingItem?: ?Item, trailingSection?: ?SectionT, + ... } { let itemIndex = index; const {getItem, getItemCount, keyExtractor, sections} = this.props; @@ -323,6 +331,7 @@ class VirtualizedSectionList< }: { viewableItems: Array, changed: Array, + ... }) => { const onViewableItemsChanged = this.props.onViewableItemsChanged; if (onViewableItemsChanged != null) { @@ -335,7 +344,7 @@ class VirtualizedSectionList< } }; - _renderItem = ({item, index}: {item: Item, index: number}) => { + _renderItem = ({item, index}: {item: Item, index: number, ...}) => { const info = this._subExtractor(index); if (!info) { return null; @@ -448,6 +457,7 @@ type ItemWithSeparatorState = { highlighted: false, ...ItemWithSeparatorCommonProps, |}>, + ... }; class ItemWithSeparator extends React.Component< diff --git a/Libraries/LogBox/Data/parseLogBoxLog.js b/Libraries/LogBox/Data/parseLogBoxLog.js index 96e0a219cf4..095ad59199d 100644 --- a/Libraries/LogBox/Data/parseLogBoxLog.js +++ b/Libraries/LogBox/Data/parseLogBoxLog.js @@ -15,13 +15,17 @@ import stringifySafe from '../../Utilities/stringifySafe'; import type {ExceptionData} from '../../Core/NativeExceptionsManager'; import type {LogBoxLogData} from './LogBoxLog'; -export type ExtendedExceptionData = ExceptionData & {isComponentError: boolean}; +export type ExtendedExceptionData = ExceptionData & { + isComponentError: boolean, + ... +}; export type Category = string; export type CodeFrame = $ReadOnly<{| content: string, location: { row: number, column: number, + ... }, fileName: string, |}>; diff --git a/Libraries/LogBox/LogBox.js b/Libraries/LogBox/LogBox.js index 0a56ddb4f93..fb5ec6bc27e 100644 --- a/Libraries/LogBox/LogBox.js +++ b/Libraries/LogBox/LogBox.js @@ -257,4 +257,5 @@ module.exports = (LogBoxComponent: Class> & { ignoreLogs($ReadOnlyArray): void, install(): void, uninstall(): void, + ... }); diff --git a/Libraries/LogBox/UI/LogBoxMessage.js b/Libraries/LogBox/UI/LogBoxMessage.js index 2f467b5673c..8bd2740a2ea 100644 --- a/Libraries/LogBox/UI/LogBoxMessage.js +++ b/Libraries/LogBox/UI/LogBoxMessage.js @@ -21,6 +21,7 @@ type Props = { style: TextStyleProp, plaintext?: ?boolean, maxLength?: ?number, + ... }; const cleanContent = content => content.replace(/(Warning|Error): /g, ''); diff --git a/Libraries/Network/FormData.js b/Libraries/Network/FormData.js index ff618c0180a..bdb1da311da 100644 --- a/Libraries/Network/FormData.js +++ b/Libraries/Network/FormData.js @@ -13,17 +13,19 @@ type FormDataValue = any; type FormDataNameValuePair = [string, FormDataValue]; -type Headers = {[name: string]: string}; +type Headers = {[name: string]: string, ...}; type FormDataPart = | { string: string, headers: Headers, + ... } | { uri: string, headers: Headers, name?: string, type?: string, + ... }; /** diff --git a/Libraries/Network/XMLHttpRequest.js b/Libraries/Network/XMLHttpRequest.js index 14e06222b68..e25e876e814 100644 --- a/Libraries/Network/XMLHttpRequest.js +++ b/Libraries/Network/XMLHttpRequest.js @@ -39,6 +39,7 @@ type XHRInterceptor = { dataReceived(id: number, data: string): void, loadingFinished(id: number, encodedDataLength: number): void, loadingFailed(id: number, error: string): void, + ... }; // The native blob module is optional so inject it here if available. diff --git a/Libraries/Network/convertRequestBody.js b/Libraries/Network/convertRequestBody.js index 820fec0642b..0db3ed70977 100644 --- a/Libraries/Network/convertRequestBody.js +++ b/Libraries/Network/convertRequestBody.js @@ -19,7 +19,7 @@ export type RequestBody = | string | Blob | FormData - | {uri: string} + | {uri: string, ...} | ArrayBuffer | $ArrayBufferView; diff --git a/Libraries/Performance/PureComponentDebug.js b/Libraries/Performance/PureComponentDebug.js index 9932b5fd4e8..982ed49353c 100644 --- a/Libraries/Performance/PureComponentDebug.js +++ b/Libraries/Performance/PureComponentDebug.js @@ -12,7 +12,7 @@ const React = require('react'); -opaque type DoNotCommitUsageOfPureComponentDebug = {}; +opaque type DoNotCommitUsageOfPureComponentDebug = {...}; /** * Identifies which prop or state changes triggered a re-render of a PureComponent. Usage: diff --git a/Libraries/PermissionsAndroid/NativePermissionsAndroid.js b/Libraries/PermissionsAndroid/NativePermissionsAndroid.js index 843c0aeaa98..14aba8f1116 100644 --- a/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +++ b/Libraries/PermissionsAndroid/NativePermissionsAndroid.js @@ -54,7 +54,7 @@ export interface Spec extends TurboModule { ) => Promise; +requestMultiplePermissions: ( permissions: Array, - ) => Promise<{[permission: PermissionType]: PermissionStatus}>; + ) => Promise<{[permission: PermissionType]: PermissionStatus, ...}>; } export default (TurboModuleRegistry.get('PermissionsAndroid'): ?Spec); diff --git a/Libraries/PermissionsAndroid/PermissionsAndroid.js b/Libraries/PermissionsAndroid/PermissionsAndroid.js index 29c744181b8..d0ded058035 100644 --- a/Libraries/PermissionsAndroid/PermissionsAndroid.js +++ b/Libraries/PermissionsAndroid/PermissionsAndroid.js @@ -26,6 +26,7 @@ export type Rationale = { buttonPositive?: string, buttonNegative?: string, buttonNeutral?: string, + ... }; const PERMISSION_REQUEST_RESULT = Object.freeze({ @@ -239,7 +240,7 @@ class PermissionsAndroid { */ requestMultiple( permissions: Array, - ): Promise<{[permission: PermissionType]: PermissionStatus}> { + ): Promise<{[permission: PermissionType]: PermissionStatus, ...}> { if (Platform.OS !== 'android') { console.warn( '"PermissionsAndroid" module works only for Android platform.', diff --git a/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js b/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js index 3ff1b129841..2e2044262ee 100644 --- a/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js +++ b/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js @@ -32,7 +32,7 @@ type Notification = {| |}; export interface Spec extends TurboModule { - +getConstants: () => {}; + +getConstants: () => {...}; +onFinishRemoteNotification: ( notificationId: string, /** diff --git a/Libraries/PushNotificationIOS/PushNotificationIOS.js b/Libraries/PushNotificationIOS/PushNotificationIOS.js index 43548d4a7aa..66c5c541675 100644 --- a/Libraries/PushNotificationIOS/PushNotificationIOS.js +++ b/Libraries/PushNotificationIOS/PushNotificationIOS.js @@ -31,6 +31,7 @@ export type FetchResult = { NewData: string, NoData: string, ResultFailed: string, + ... }; /** @@ -58,6 +59,7 @@ export type PushNotificationEventName = $Keys<{ * handler will be invoked with {message: string, code: number, details: any}. */ registrationError: string, + ... }>; /** @@ -301,10 +303,12 @@ class PushNotificationIOS { alert?: boolean, badge?: boolean, sound?: boolean, + ... }): Promise<{ alert: boolean, badge: boolean, sound: boolean, + ... }> { let requestedPermissions = { alert: true, diff --git a/Libraries/ReactNative/AppContainer.js b/Libraries/ReactNative/AppContainer.js index 388fbba8542..a5ae75d822a 100644 --- a/Libraries/ReactNative/AppContainer.js +++ b/Libraries/ReactNative/AppContainer.js @@ -19,9 +19,7 @@ const RootTagContext = require('./RootTagContext'); const StyleSheet = require('../StyleSheet/StyleSheet'); const View = require('../Components/View/View'); -type Context = { - rootTag: number, -}; +type Context = {rootTag: number, ...}; type Props = $ReadOnly<{| children?: React.Node, diff --git a/Libraries/ReactNative/AppRegistry.js b/Libraries/ReactNative/AppRegistry.js index e5bc300feb5..ca553cbd0c3 100644 --- a/Libraries/ReactNative/AppRegistry.js +++ b/Libraries/ReactNative/AppRegistry.js @@ -39,17 +39,18 @@ export type AppConfig = { component?: ComponentProvider, run?: Function, section?: boolean, + ... }; export type Runnable = { component?: ComponentProvider, run: Function, + ... }; -export type Runnables = { - [appKey: string]: Runnable, -}; +export type Runnables = {[appKey: string]: Runnable, ...}; export type Registry = { sections: Array, runnables: Runnables, + ... }; export type WrapperComponentProvider = any => React$ComponentType<*>; diff --git a/Libraries/ReactNative/FabricUIManager.js b/Libraries/ReactNative/FabricUIManager.js index e631a9af251..7424d51d45b 100644 --- a/Libraries/ReactNative/FabricUIManager.js +++ b/Libraries/ReactNative/FabricUIManager.js @@ -17,10 +17,10 @@ import type { } from '../Renderer/shims/ReactNativeTypes'; // TODO: type these properly. -type Node = {}; +type Node = {...}; type NodeSet = Array; -type NodeProps = {}; -type InstanceHandle = {}; +type NodeProps = {...}; +type InstanceHandle = {...}; type Spec = {| +createNode: ( reactTag: number, diff --git a/Libraries/Renderer/shims/ReactNativeTypes.js b/Libraries/Renderer/shims/ReactNativeTypes.js index 7aa6c59a67b..cf20ce938c2 100644 --- a/Libraries/Renderer/shims/ReactNativeTypes.js +++ b/Libraries/Renderer/shims/ReactNativeTypes.js @@ -45,9 +45,8 @@ export type AttributeConfiguration< TStyleProps = string, > = $ReadOnly<{ [propName: TProps]: AttributeType, - style: $ReadOnly<{ - [propName: TStyleProps]: AttributeType, - }>, + style: $ReadOnly<{[propName: TStyleProps]: AttributeType, ...}>, + ... }>; export type ReactNativeBaseComponentViewConfig< @@ -62,18 +61,16 @@ export type ReactNativeBaseComponentViewConfig< bubbled: string, |}>, |}>, + ..., }>, - Commands?: $ReadOnly<{ - [commandName: string]: number, - }>, + Commands?: $ReadOnly<{[commandName: string]: number, ...}>, directEventTypes?: $ReadOnly<{ [eventName: string]: $ReadOnly<{| registrationName: string, |}>, + ..., }>, - NativeProps?: $ReadOnly<{ - [propName: string]: string, - }>, + NativeProps?: $ReadOnly<{[propName: string]: string, ...}>, uiViewClassName: string, validAttributes: AttributeConfiguration, |}>; @@ -116,6 +113,7 @@ export type NativeMethods = { onFail?: () => void, ): void, setNativeProps(nativeProps: Object): void, + ... }; export type NativeMethodsMixinType = NativeMethods; @@ -126,10 +124,12 @@ type SecretInternalsType = { computeComponentStackForErrorReporting(tag: number): string, // TODO (bvaughn) Decide which additional types to expose here? // And how much information to fill in for the above types. + ... }; type SecretInternalsFabricType = { NativeMethodsMixin: NativeMethodsMixinType, + ... }; /** @@ -150,9 +150,10 @@ export type ReactNativeType = { ): any, unmountComponentAtNode(containerTag: number): any, unmountComponentAtNodeAndRemoveContainer(containerTag: number): any, - unstable_batchedUpdates: any, // TODO (bvaughn) Add types - + // TODO (bvaughn) Add types + unstable_batchedUpdates: any, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: SecretInternalsType, + ... }; export type ReactFabricType = { @@ -167,6 +168,7 @@ export type ReactFabricType = { ): any, unmountComponentAtNode(containerTag: number): any, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: SecretInternalsFabricType, + ... }; export type ReactNativeEventTarget = { @@ -176,7 +178,9 @@ export type ReactNativeEventTarget = { viewConfig: ReactNativeBaseComponentViewConfig<>, currentProps: Object, _internalInstanceHandle: Object, + ... }, + ... }; export type ReactFaricEventTouch = { @@ -190,6 +194,7 @@ export type ReactFaricEventTouch = { target: number, timestamp: number, force: number, + ... }; export type ReactFaricEvent = { @@ -197,12 +202,14 @@ export type ReactFaricEvent = { changedTouches: Array, targetTouches: Array, target: number, + ... }; export type ReactNativeResponderEvent = { nativeEvent: ReactFaricEvent, target: null | ReactNativeEventTarget, type: string, + ... }; export type ReactNativeResponderContext = { @@ -222,12 +229,14 @@ export type ReactNativeResponderContext = { right: number, top: number, bottom: number, + ... }) => void, ): void, addRootEventTypes: (rootEventTypes: Array) => void, removeRootEventTypes: (rootEventTypes: Array) => void, getTimeStamp: () => number, getResponderNode(): ReactNativeEventTarget | null, + ... }; export type PointerType = diff --git a/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js b/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js index 4653e2db9be..e6e3b13b8e8 100644 --- a/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +++ b/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js @@ -27,11 +27,13 @@ const customBubblingEventTypes: { bubbled: string, |}>, |}>, + ..., } = {}; const customDirectEventTypes: { [eventName: string]: $ReadOnly<{| registrationName: string, |}>, + ..., } = {}; exports.customBubblingEventTypes = customBubblingEventTypes; diff --git a/Libraries/Renderer/shims/ReactTypes.js b/Libraries/Renderer/shims/ReactTypes.js index d24e23a55a0..e97e5823393 100644 --- a/Libraries/Renderer/shims/ReactTypes.js +++ b/Libraries/Renderer/shims/ReactTypes.js @@ -31,12 +31,15 @@ export type ReactProvider = { props: { value: T, children?: ReactNodeList, + ... }, + ... }; export type ReactProviderType = { $$typeof: Symbol | number, _context: ReactContext, + ... }; export type ReactConsumer = { @@ -47,23 +50,23 @@ export type ReactConsumer = { props: { children: (value: T) => ReactNodeList, unstable_observedBits?: number, + ... }, + ... }; export type ReactContext = { $$typeof: Symbol | number, Consumer: ReactContext, Provider: ReactProviderType, - _calculateChangedBits: ((a: T, b: T) => number) | null, - _currentValue: T, _currentValue2: T, _threadCount: number, - // DEV only _currentRenderer?: Object | null, _currentRenderer2?: Object | null, + ... }; export type ReactPortal = { @@ -73,6 +76,7 @@ export type ReactPortal = { children: ReactNodeList, // TODO: figure out the API for cross-renderer implementation. implementation: any, + ... }; export type RefObject = {| @@ -107,6 +111,7 @@ export type ReactEventResponder = { | ((event: E, context: C, props: Object, state: Object) => void), onMount: null | ((context: C, props: Object, state: Object) => void), onUnmount: null | ((context: C, props: Object, state: Object) => void), + ... }; export type EventPriority = 0 | 1 | 2; @@ -153,6 +158,7 @@ export type ReactFundamentalImpl = { ) => void, onHydrate?: (context: C, props: Object, state: Object) => boolean, onFocus?: (context: C, props: Object, state: Object) => boolean, + ... }; export type ReactFundamentalComponent = {| diff --git a/Libraries/Settings/Settings.ios.js b/Libraries/Settings/Settings.ios.js index 55d8ff0481d..cba39734037 100644 --- a/Libraries/Settings/Settings.ios.js +++ b/Libraries/Settings/Settings.ios.js @@ -16,7 +16,11 @@ const invariant = require('invariant'); import NativeSettingsManager from './NativeSettingsManager'; -const subscriptions: Array<{keys: Array, callback: ?Function}> = []; +const subscriptions: Array<{ + keys: Array, + callback: ?Function, + ... +}> = []; const Settings = { _settings: (NativeSettingsManager && diff --git a/Libraries/Share/Share.js b/Libraries/Share/Share.js index 1b064db277f..8d46c5eb1f6 100644 --- a/Libraries/Share/Share.js +++ b/Libraries/Share/Share.js @@ -19,13 +19,22 @@ import NativeActionSheetManager from '../ActionSheetIOS/NativeActionSheetManager import NativeShareModule from './NativeShareModule'; type Content = - | {title?: string, message: string} - | {title?: string, url: string}; + | { + title?: string, + message: string, + ... + } + | { + title?: string, + url: string, + ... + }; type Options = { dialogTitle?: string, excludedActivityTypes?: Array, tintColor?: string, subject?: string, + ... }; class Share { diff --git a/Libraries/StyleSheet/PointPropType.js b/Libraries/StyleSheet/PointPropType.js index 302892edae3..9fd9789a4ad 100644 --- a/Libraries/StyleSheet/PointPropType.js +++ b/Libraries/StyleSheet/PointPropType.js @@ -13,4 +13,5 @@ export type PointProp = $ReadOnly<{ x: number, y: number, + ... }>; diff --git a/Libraries/StyleSheet/StyleSheetTypes.js b/Libraries/StyleSheet/StyleSheetTypes.js index bda8397b4bf..7d5d2f59afa 100644 --- a/Libraries/StyleSheet/StyleSheetTypes.js +++ b/Libraries/StyleSheet/StyleSheetTypes.js @@ -643,6 +643,7 @@ export type ____DangerouslyImpreciseStyle_Internal = { +resizeMode?: 'contain' | 'cover' | 'stretch' | 'center' | 'repeat', +tintColor?: ColorValue, +overlayColor?: string, + ... }; type GenericStyleProp<+T> = @@ -668,4 +669,5 @@ export type ____ImageStyleProp_Internal = GenericStyleProp< export type ____Styles_Internal = { +[key: string]: $Shape<____DangerouslyImpreciseStyle_Internal>, + ..., }; diff --git a/Libraries/StyleSheet/splitLayoutProps.js b/Libraries/StyleSheet/splitLayoutProps.js index ab4197cc45e..953b3e55f46 100644 --- a/Libraries/StyleSheet/splitLayoutProps.js +++ b/Libraries/StyleSheet/splitLayoutProps.js @@ -44,6 +44,7 @@ function splitLayoutProps( ): { outer: DangerouslyImpreciseStyle, inner: DangerouslyImpreciseStyle, + ... } { const inner = {}; const outer = {}; diff --git a/Libraries/TurboModule/RCTExport.js b/Libraries/TurboModule/RCTExport.js index 9e8a884d2b7..a0fc78fc96c 100644 --- a/Libraries/TurboModule/RCTExport.js +++ b/Libraries/TurboModule/RCTExport.js @@ -30,7 +30,7 @@ // eslint-disable-next-line no-unused-vars export interface DEPRECATED_RCTExport { - +getConstants?: () => {}; + +getConstants?: () => {...}; } // eslint-disable-next-line lint/react-native-modules diff --git a/Libraries/Utilities/BackHandler.android.js b/Libraries/Utilities/BackHandler.android.js index 6ddc3eea078..e6e3d035295 100644 --- a/Libraries/Utilities/BackHandler.android.js +++ b/Libraries/Utilities/BackHandler.android.js @@ -64,7 +64,7 @@ type TBackHandler = {| +addEventListener: ( eventName: BackPressEventName, handler: Function, - ) => {remove: () => void}, + ) => {remove: () => void, ...}, +removeEventListener: ( eventName: BackPressEventName, handler: Function, @@ -88,7 +88,7 @@ const BackHandler: TBackHandler = { addEventListener: function( eventName: BackPressEventName, handler: Function, - ): {remove: () => void} { + ): {remove: () => void, ...} { if (_backPressSubscriptions.indexOf(handler) === -1) { _backPressSubscriptions.push(handler); } diff --git a/Libraries/Utilities/BackHandler.ios.js b/Libraries/Utilities/BackHandler.ios.js index e4a49652a66..ff2f1c862e5 100644 --- a/Libraries/Utilities/BackHandler.ios.js +++ b/Libraries/Utilities/BackHandler.ios.js @@ -55,7 +55,7 @@ type TBackHandler = {| +addEventListener: ( eventName: BackPressEventName, handler: Function, - ) => {remove: () => void}, + ) => {remove: () => void, ...}, +removeEventListener: ( eventName: BackPressEventName, handler: Function, @@ -94,7 +94,7 @@ if (Platform.isTV) { addEventListener: function( eventName: BackPressEventName, handler: Function, - ): {remove: () => void} { + ): {remove: () => void, ...} { _backPressSubscriptions.add(handler); return { remove: () => BackHandler.removeEventListener(eventName, handler), diff --git a/Libraries/Utilities/Dimensions.js b/Libraries/Utilities/Dimensions.js index 4a07a7f38c3..3cc28bc0ff6 100644 --- a/Libraries/Utilities/Dimensions.js +++ b/Libraries/Utilities/Dimensions.js @@ -18,7 +18,11 @@ import NativeDeviceInfo, { } from './NativeDeviceInfo'; import invariant from 'invariant'; -type DimensionsValue = {window?: DisplayMetrics, screen?: DisplayMetrics}; +type DimensionsValue = { + window?: DisplayMetrics, + screen?: DisplayMetrics, + ... +}; const eventEmitter = new EventEmitter(); let dimensionsInitialized = false; @@ -53,7 +57,7 @@ class Dimensions { * * @param {object} dims Simple string-keyed object of dimensions to set */ - static set(dims: $ReadOnly<{[key: string]: any}>): void { + static set(dims: $ReadOnly<{[key: string]: any, ...}>): void { // We calculate the window dimensions in JS so that we don't encounter loss of // precision in transferring the dimensions (which could be non-integers) over // the bridge. @@ -118,7 +122,7 @@ class Dimensions { } } -let initialDims: ?$ReadOnly<{[key: string]: any}> = +let initialDims: ?$ReadOnly<{[key: string]: any, ...}> = global.nativeExtensions && global.nativeExtensions.DeviceInfo && global.nativeExtensions.DeviceInfo.Dimensions; diff --git a/Libraries/Utilities/Platform.android.js b/Libraries/Utilities/Platform.android.js index 4a4de286938..13b0586701e 100644 --- a/Libraries/Utilities/Platform.android.js +++ b/Libraries/Utilities/Platform.android.js @@ -16,6 +16,7 @@ export type PlatformSelectSpec = { android?: A, native?: N, default?: D, + ... }; const Platform = { diff --git a/Libraries/Utilities/Platform.ios.js b/Libraries/Utilities/Platform.ios.js index ed933099e6e..2b8afec73e4 100644 --- a/Libraries/Utilities/Platform.ios.js +++ b/Libraries/Utilities/Platform.ios.js @@ -16,6 +16,7 @@ export type PlatformSelectSpec = { default?: D, native?: N, ios?: I, + ... }; const Platform = { diff --git a/Libraries/Utilities/ReactNativeTestTools.js b/Libraries/Utilities/ReactNativeTestTools.js index 89ca1e1ef30..14250ad9329 100644 --- a/Libraries/Utilities/ReactNativeTestTools.js +++ b/Libraries/Utilities/ReactNativeTestTools.js @@ -64,7 +64,7 @@ function enter(instance: ReactTestInstance, text: string) { // Returns null if there is no error, otherwise returns an error message string. function maximumDepthError( - tree: {toJSON: () => ReactTestRendererNode}, + tree: {toJSON: () => ReactTestRendererNode, ...}, maxDepthLimit: number, ): ?string { const maxDepth = maximumDepthOfJSON(tree.toJSON()); diff --git a/Libraries/Utilities/SceneTracker.js b/Libraries/Utilities/SceneTracker.js index 266494913dc..ff3bbe07c62 100644 --- a/Libraries/Utilities/SceneTracker.js +++ b/Libraries/Utilities/SceneTracker.js @@ -10,7 +10,7 @@ 'use strict'; -type Scene = {name: string}; +type Scene = {name: string, ...}; let _listeners: Array<(scene: Scene) => void> = []; @@ -28,7 +28,7 @@ const SceneTracker = { addActiveSceneChangedListener( callback: (scene: Scene) => void, - ): {remove: () => void} { + ): {remove: () => void, ...} { _listeners.push(callback); return { remove: () => { diff --git a/Libraries/Utilities/codegenNativeCommands.js b/Libraries/Utilities/codegenNativeCommands.js index 1cee4d918af..1a7532cfddc 100644 --- a/Libraries/Utilities/codegenNativeCommands.js +++ b/Libraries/Utilities/codegenNativeCommands.js @@ -16,7 +16,7 @@ type Options = $ReadOnly<{| supportedCommands: $ReadOnlyArray, |}>; -function codegenNativeCommands(options: Options<$Keys>): T { +function codegenNativeCommands(options: Options<$Keys>): T { const commandObj = {}; options.supportedCommands.forEach(command => { diff --git a/Libraries/Utilities/createPerformanceLogger.js b/Libraries/Utilities/createPerformanceLogger.js index c9102b31426..fdd5ca9e3cf 100644 --- a/Libraries/Utilities/createPerformanceLogger.js +++ b/Libraries/Utilities/createPerformanceLogger.js @@ -23,6 +23,7 @@ type Timespan = { totalTime?: number, startTime?: number, endTime?: number, + ... }; export type IPerformanceLogger = { @@ -33,21 +34,22 @@ export type IPerformanceLogger = { clearCompleted(): void, clearExceptTimespans(Array): void, currentTimestamp(): number, - getTimespans(): {[key: string]: Timespan}, + getTimespans(): {[key: string]: Timespan, ...}, hasTimespan(string): boolean, logTimespans(): void, addTimespans(Array, Array): void, setExtra(string, any): void, - getExtras(): {[key: string]: any}, + getExtras(): {[key: string]: any, ...}, removeExtra(string): ?any, logExtras(): void, markPoint(string, number | void): void, - getPoints(): {[key: string]: number}, + getPoints(): {[key: string]: number, ...}, logPoints(): void, logEverything(): void, + ... }; -const _cookies: {[key: string]: number} = {}; +const _cookies: {[key: string]: number, ...} = {}; const PRINT_TO_CONSOLE: false = false; // Type as false to prevent accidentally committing `true`; @@ -58,9 +60,10 @@ const PRINT_TO_CONSOLE: false = false; // Type as false to prevent accidentally */ function createPerformanceLogger(): IPerformanceLogger { const result: IPerformanceLogger & { - _timespans: {[key: string]: Timespan}, - _extras: {[key: string]: any}, - _points: {[key: string]: number}, + _timespans: {[key: string]: Timespan, ...}, + _extras: {[key: string]: any, ...}, + _points: {[key: string]: number, ...}, + ... } = { _timespans: {}, _extras: {}, diff --git a/Libraries/Utilities/defineLazyObjectProperty.js b/Libraries/Utilities/defineLazyObjectProperty.js index 23aee34d999..9c5698a7036 100644 --- a/Libraries/Utilities/defineLazyObjectProperty.js +++ b/Libraries/Utilities/defineLazyObjectProperty.js @@ -20,6 +20,7 @@ function defineLazyObjectProperty( get: () => T, enumerable?: boolean, writable?: boolean, + ... }, ): void { const {get} = descriptor; diff --git a/Libraries/Utilities/differ/insetsDiffer.js b/Libraries/Utilities/differ/insetsDiffer.js index 53c9d9605c4..48aa7cac3c8 100644 --- a/Libraries/Utilities/differ/insetsDiffer.js +++ b/Libraries/Utilities/differ/insetsDiffer.js @@ -15,6 +15,7 @@ type Inset = { left: ?number, right: ?number, bottom: ?number, + ... }; const dummyInsets = { diff --git a/Libraries/Utilities/differ/pointsDiffer.js b/Libraries/Utilities/differ/pointsDiffer.js index 96fb189d43e..28d94a3b706 100644 --- a/Libraries/Utilities/differ/pointsDiffer.js +++ b/Libraries/Utilities/differ/pointsDiffer.js @@ -13,6 +13,7 @@ type Point = { x: ?number, y: ?number, + ... }; const dummyPoint = {x: undefined, y: undefined}; diff --git a/Libraries/Utilities/registerGeneratedViewConfig.js b/Libraries/Utilities/registerGeneratedViewConfig.js index 8164fede07f..7ce2c2f01f3 100644 --- a/Libraries/Utilities/registerGeneratedViewConfig.js +++ b/Libraries/Utilities/registerGeneratedViewConfig.js @@ -23,11 +23,13 @@ export type GeneratedViewConfig = { bubbled: string, |}>, |}>, + ..., }>, directEventTypes?: $ReadOnly<{ [eventName: string]: $ReadOnly<{| registrationName: string, |}>, + ..., }>, validAttributes?: { [propName: string]: @@ -36,7 +38,9 @@ export type GeneratedViewConfig = { diff?: (arg1: any, arg2: any) => boolean, process?: (arg1: any) => any, |}>, + ..., }, + ... }; function registerGeneratedViewConfig( diff --git a/Libraries/Utilities/truncate.js b/Libraries/Utilities/truncate.js index b892f0d66d4..fb3814b4a5a 100644 --- a/Libraries/Utilities/truncate.js +++ b/Libraries/Utilities/truncate.js @@ -14,6 +14,7 @@ type truncateOptions = { breakOnWords: boolean, minDelta: number, elipsis: string, + ... }; const defaultOptions = { diff --git a/Libraries/Utilities/warnOnce.js b/Libraries/Utilities/warnOnce.js index 8f7350444f1..225a2e4dfd8 100644 --- a/Libraries/Utilities/warnOnce.js +++ b/Libraries/Utilities/warnOnce.js @@ -12,7 +12,7 @@ const warning = require('fbjs/lib/warning'); -const warnedKeys: {[string]: boolean} = {}; +const warnedKeys: {[string]: boolean, ...} = {}; /** * A simple function that prints a warning message once per session. diff --git a/Libraries/WebSocket/WebSocket.js b/Libraries/WebSocket/WebSocket.js index 35f0757b4dc..a1679bd50ac 100644 --- a/Libraries/WebSocket/WebSocket.js +++ b/Libraries/WebSocket/WebSocket.js @@ -85,7 +85,7 @@ class WebSocket extends (EventTarget(...WEBSOCKET_EVENTS): any) { constructor( url: string, protocols: ?string | ?Array, - options: ?{headers?: {origin?: string}}, + options: ?{headers?: {origin?: string, ...}, ...}, ) { super(); if (typeof protocols === 'string') { diff --git a/Libraries/YellowBox/Data/YellowBoxRegistry.js b/Libraries/YellowBox/Data/YellowBoxRegistry.js index 1ecbb700ae0..95763ab0c7c 100644 --- a/Libraries/YellowBox/Data/YellowBoxRegistry.js +++ b/Libraries/YellowBox/Data/YellowBoxRegistry.js @@ -24,7 +24,7 @@ export type Subscription = $ReadOnly<{| unsubscribe: () => void, |}>; -const observers: Set<{observer: Observer}> = new Set(); +const observers: Set<{observer: Observer, ...}> = new Set(); const ignorePatterns: Set = new Set(); const registry: Registry = new Map(); diff --git a/Libraries/YellowBox/YellowBox.js b/Libraries/YellowBox/YellowBox.js index 825b2590653..b91e88f6447 100644 --- a/Libraries/YellowBox/YellowBox.js +++ b/Libraries/YellowBox/YellowBox.js @@ -172,4 +172,5 @@ module.exports = (YellowBox: Class> & { ignoreWarnings($ReadOnlyArray): void, install(): void, uninstall(): void, + ... }); diff --git a/RNTester/RCTTest/RCTSnapshotNativeComponent.js b/RNTester/RCTTest/RCTSnapshotNativeComponent.js index 9cd05e5637f..7b7b3dcdbc1 100644 --- a/RNTester/RCTTest/RCTSnapshotNativeComponent.js +++ b/RNTester/RCTTest/RCTSnapshotNativeComponent.js @@ -17,9 +17,7 @@ import type {SyntheticEvent} from '../../Libraries/Types/CoreEventTypes'; import type {ViewProps} from '../../Libraries/Components/View/ViewPropTypes'; type SnapshotReadyEvent = SyntheticEvent< - $ReadOnly<{ - testIdentifier: string, - }>, + $ReadOnly<{testIdentifier: string, ...}>, >; type NativeProps = $ReadOnly<{| diff --git a/RNTester/js/RNTesterApp.android.js b/RNTester/js/RNTesterApp.android.js index b3afbc4ef09..fd3655deec2 100644 --- a/RNTester/js/RNTesterApp.android.js +++ b/RNTester/js/RNTesterApp.android.js @@ -45,9 +45,7 @@ UIManager.setLayoutAnimationEnabledExperimental(true); const DRAWER_WIDTH_LEFT = 56; -type Props = { - exampleFromAppetizeParams?: ?string, -}; +type Props = {exampleFromAppetizeParams?: ?string, ...}; const APP_STATE_KEY = 'RNTesterAppState.v2'; @@ -63,6 +61,7 @@ const Header = ({ }: { onPressDrawer?: () => mixed, title: string, + ... }) => ( {theme => { @@ -94,6 +93,7 @@ const RNTesterExampleContainerViaHook = ({ title: string, module: RNTesterExample, exampleRef: () => void, + ... }) => { const colorScheme = useColorScheme(); const theme = colorScheme === 'dark' ? themes.dark : themes.light; @@ -115,7 +115,9 @@ const RNTesterDrawerContentViaHook = ({ list: { ComponentExamples: Array, APIExamples: Array, + ... }, + ... }) => { const colorScheme = useColorScheme(); const theme = colorScheme === 'dark' ? themes.dark : themes.light; @@ -149,7 +151,9 @@ const RNTesterExampleListViaHook = ({ list: { ComponentExamples: Array, APIExamples: Array, + ... }, + ... }) => { const colorScheme = useColorScheme(); const theme = colorScheme === 'dark' ? themes.dark : themes.light; diff --git a/RNTester/js/RNTesterApp.ios.js b/RNTester/js/RNTesterApp.ios.js index a92e634b70a..8245a68d12b 100644 --- a/RNTester/js/RNTesterApp.ios.js +++ b/RNTester/js/RNTesterApp.ios.js @@ -40,9 +40,7 @@ import type {RNTesterNavigationState} from './utils/RNTesterNavigationReducer'; import {RNTesterThemeContext, themes} from './components/RNTesterTheme'; import type {ColorSchemeName} from '../../Libraries/Utilities/NativeAppearance'; -type Props = { - exampleFromAppetizeParams?: ?string, -}; +type Props = {exampleFromAppetizeParams?: ?string, ...}; YellowBox.ignoreWarnings([ 'Module RCTImagePickerManager requires main queue setup', @@ -50,7 +48,14 @@ YellowBox.ignoreWarnings([ const APP_STATE_KEY = 'RNTesterAppState.v2'; -const Header = ({onBack, title}: {onBack?: () => mixed, title: string}) => ( +const Header = ({ + onBack, + title, +}: { + onBack?: () => mixed, + title: string, + ... +}) => ( {theme => { return ( @@ -95,6 +100,7 @@ const RNTesterExampleContainerViaHook = ({ onBack?: () => mixed, title: string, module: RNTesterExample, + ... }) => { const colorScheme: ?ColorSchemeName = useColorScheme(); const theme = colorScheme === 'dark' ? themes.dark : themes.light; @@ -116,7 +122,9 @@ const RNTesterExampleListViaHook = ({ list: { ComponentExamples: Array, APIExamples: Array, + ... }, + ... }) => { const colorScheme: ?ColorSchemeName = useColorScheme(); const theme = colorScheme === 'dark' ? themes.dark : themes.light; @@ -245,7 +253,7 @@ RNTesterList.ComponentExamples.concat(RNTesterList.APIExamples).forEach( (Example: RNTesterExample) => { const ExampleModule = Example.module; if (ExampleModule.displayName) { - class Snapshotter extends React.Component<{}> { + class Snapshotter extends React.Component<{...}> { render() { return ( diff --git a/RNTester/js/components/ListExampleShared.js b/RNTester/js/components/ListExampleShared.js index 82a53273279..522d72e3d93 100644 --- a/RNTester/js/components/ListExampleShared.js +++ b/RNTester/js/components/ListExampleShared.js @@ -30,6 +30,7 @@ export type Item = { key: string, pressed: boolean, noImage?: ?boolean, + ... }; function genItemData(count: number, start: number = 0): Array { @@ -56,6 +57,7 @@ class ItemComponent extends React.PureComponent<{ onPress: (key: string) => void, onShowUnderlay?: () => void, onHideUnderlay?: () => void, + ... }> { _onPress = () => { this.props.onPress(this.props.item.key); @@ -88,7 +90,7 @@ class ItemComponent extends React.PureComponent<{ } } -const renderStackedItem = ({item}: {item: Item}): React.Node => { +const renderStackedItem = ({item}: {item: Item, ...}): React.Node => { const itemHash = Math.abs(hashCode(item.title)); const imgSource = THUMB_URLS[itemHash % THUMB_URLS.length]; return ( @@ -101,7 +103,7 @@ const renderStackedItem = ({item}: {item: Item}): React.Node => { ); }; -class FooterComponent extends React.PureComponent<{}> { +class FooterComponent extends React.PureComponent<{...}> { render(): React.Node { return ( @@ -114,7 +116,7 @@ class FooterComponent extends React.PureComponent<{}> { } } -class HeaderComponent extends React.PureComponent<{}> { +class HeaderComponent extends React.PureComponent<{...}> { render(): React.Node { return ( @@ -127,7 +129,7 @@ class HeaderComponent extends React.PureComponent<{}> { } } -class ListEmptyComponent extends React.PureComponent<{}> { +class ListEmptyComponent extends React.PureComponent<{...}> { render(): React.Node { return ( @@ -137,7 +139,7 @@ class ListEmptyComponent extends React.PureComponent<{}> { } } -class SeparatorComponent extends React.PureComponent<{}> { +class SeparatorComponent extends React.PureComponent<{...}> { render(): React.Node { return ; } diff --git a/RNTester/js/components/RNTesterExampleFilter.js b/RNTester/js/components/RNTesterExampleFilter.js index 841cd2e657d..992f30e6bc6 100644 --- a/RNTester/js/components/RNTesterExampleFilter.js +++ b/RNTester/js/components/RNTesterExampleFilter.js @@ -21,11 +21,10 @@ type Props = { sections: Object, disableSearch?: boolean, testID?: string, + ... }; -type State = { - filter: string, -}; +type State = {filter: string, ...}; class RNTesterExampleFilter extends React.Component { state: State = {filter: ''}; diff --git a/RNTester/js/components/RNTesterExampleList.js b/RNTester/js/components/RNTesterExampleList.js index 3dcc9c8c1ec..bbbfb764a77 100644 --- a/RNTester/js/components/RNTesterExampleList.js +++ b/RNTester/js/components/RNTesterExampleList.js @@ -33,8 +33,10 @@ type Props = { list: { ComponentExamples: Array, APIExamples: Array, + ... }, style?: ?ViewStyleProp, + ... }; class RowComponent extends React.PureComponent<{ @@ -43,6 +45,7 @@ class RowComponent extends React.PureComponent<{ onPress?: Function, onShowUnderlay?: Function, onHideUnderlay?: Function, + ... }> { _onPress = () => { if (this.props.onPress) { diff --git a/RNTester/js/components/RNTesterTheme.js b/RNTester/js/components/RNTesterTheme.js index 5f2789b4c84..b78a8344fe2 100644 --- a/RNTester/js/components/RNTesterTheme.js +++ b/RNTester/js/components/RNTesterTheme.js @@ -34,6 +34,7 @@ export type RNTesterTheme = { LinkColor: string, SystemPurpleColor: string, ToolbarColor: string, + ... }; export const RNTesterLightTheme = { diff --git a/RNTester/js/components/createExamplePage.js b/RNTester/js/components/createExamplePage.js index 05db48f0ad9..b508bc0dd91 100644 --- a/RNTester/js/components/createExamplePage.js +++ b/RNTester/js/components/createExamplePage.js @@ -19,7 +19,7 @@ const createExamplePage = function( title: ?string, exampleModule: RNTesterExample, ): React.ComponentType { - class ExamplePage extends React.Component<{}> { + class ExamplePage extends React.Component<{...}> { render() { return ; } diff --git a/RNTester/js/examples/Animated/AnimatedGratuitousApp/AnExApp.js b/RNTester/js/examples/Animated/AnimatedGratuitousApp/AnExApp.js index 993dc4129f1..849efab08ea 100644 --- a/RNTester/js/examples/Animated/AnimatedGratuitousApp/AnExApp.js +++ b/RNTester/js/examples/Animated/AnimatedGratuitousApp/AnExApp.js @@ -311,7 +311,11 @@ class AnExApp extends React.Component { } } -type Point = {x: number, y: number}; +type Point = { + x: number, + y: number, + ... +}; function distance(p1: Point, p2: Point): number { const dx = p1.x - p2.x; const dy = p1.y - p2.y; diff --git a/RNTester/js/examples/Appearance/AppearanceExample.js b/RNTester/js/examples/Appearance/AppearanceExample.js index bc8f163026e..ab99e9213bf 100644 --- a/RNTester/js/examples/Appearance/AppearanceExample.js +++ b/RNTester/js/examples/Appearance/AppearanceExample.js @@ -16,8 +16,8 @@ import type {AppearancePreferences} from '../../../../Libraries/Utilities/Native import {RNTesterThemeContext, themes} from '../../components/RNTesterTheme'; class ColorSchemeSubscription extends React.Component< - {}, - {colorScheme: ?string}, + {...}, + {colorScheme: ?string, ...}, > { state = { colorScheme: Appearance.getColorScheme(), diff --git a/RNTester/js/examples/AsyncStorage/AsyncStorageExample.js b/RNTester/js/examples/AsyncStorage/AsyncStorageExample.js index dd20ff711f6..cbbb13acdbd 100644 --- a/RNTester/js/examples/AsyncStorage/AsyncStorageExample.js +++ b/RNTester/js/examples/AsyncStorage/AsyncStorageExample.js @@ -17,7 +17,7 @@ const PickerItemIOS = PickerIOS.Item; const STORAGE_KEY = '@AsyncStorageExample:key'; const COLORS = ['red', 'orange', 'yellow', 'green', 'blue']; -class BasicStorageExample extends React.Component<{}, $FlowFixMeState> { +class BasicStorageExample extends React.Component<{...}, $FlowFixMeState> { state = { selectedValue: COLORS[0], messages: [], diff --git a/RNTester/js/examples/Dimensions/DimensionsExample.js b/RNTester/js/examples/Dimensions/DimensionsExample.js index c593cec95ec..b5d0e4fe630 100644 --- a/RNTester/js/examples/Dimensions/DimensionsExample.js +++ b/RNTester/js/examples/Dimensions/DimensionsExample.js @@ -14,8 +14,8 @@ import {Dimensions, Text, useWindowDimensions} from 'react-native'; import * as React from 'react'; class DimensionsSubscription extends React.Component< - {dim: string}, - {dims: Object}, + {dim: string, ...}, + {dims: Object, ...}, > { state = { dims: Dimensions.get(this.props.dim), diff --git a/RNTester/js/examples/FlatList/FlatListExample.js b/RNTester/js/examples/FlatList/FlatListExample.js index a633d4be928..c452ace6040 100644 --- a/RNTester/js/examples/FlatList/FlatListExample.js +++ b/RNTester/js/examples/FlatList/FlatListExample.js @@ -236,7 +236,9 @@ class FlatListExample extends React.PureComponent { item: any, index: ?number, section?: any, + ... }>, + ... }) => { // Impressions can be logged here if (this.state.logViewable) { diff --git a/RNTester/js/examples/Layout/LayoutAnimationExample.js b/RNTester/js/examples/Layout/LayoutAnimationExample.js index 8c724166002..4a0eac9fc58 100644 --- a/RNTester/js/examples/Layout/LayoutAnimationExample.js +++ b/RNTester/js/examples/Layout/LayoutAnimationExample.js @@ -19,7 +19,7 @@ const { TouchableOpacity, } = require('react-native'); -class AddRemoveExample extends React.Component<{}, $FlowFixMeState> { +class AddRemoveExample extends React.Component<{...}, $FlowFixMeState> { state = { views: [], }; @@ -74,7 +74,7 @@ const BlueSquare = () => ( ); -class CrossFadeExample extends React.Component<{}, $FlowFixMeState> { +class CrossFadeExample extends React.Component<{...}, $FlowFixMeState> { state = { toggled: false, }; @@ -102,7 +102,7 @@ class CrossFadeExample extends React.Component<{}, $FlowFixMeState> { } } -class LayoutUpdateExample extends React.Component<{}, $FlowFixMeState> { +class LayoutUpdateExample extends React.Component<{...}, $FlowFixMeState> { state = { width: 200, height: 100, diff --git a/RNTester/js/examples/Layout/LayoutEventsExample.js b/RNTester/js/examples/Layout/LayoutEventsExample.js index 000b52dafc1..4791cba84a9 100644 --- a/RNTester/js/examples/Layout/LayoutEventsExample.js +++ b/RNTester/js/examples/Layout/LayoutEventsExample.js @@ -33,6 +33,7 @@ type State = { textLayout?: ViewLayout, viewLayout?: ViewLayout, viewStyle: {|margin: number|}, + ... }; class LayoutEventExample extends React.Component { diff --git a/RNTester/js/examples/Modal/ModalExample.js b/RNTester/js/examples/Modal/ModalExample.js index 2279df565e6..d8418f496fe 100644 --- a/RNTester/js/examples/Modal/ModalExample.js +++ b/RNTester/js/examples/Modal/ModalExample.js @@ -71,7 +71,7 @@ const supportedOrientationsPickerValues = [ [], ]; -class ModalExample extends React.Component<{}, $FlowFixMeState> { +class ModalExample extends React.Component<{...}, $FlowFixMeState> { state = { animationType: 'none', modalVisible: false, diff --git a/RNTester/js/examples/MultiColumn/MultiColumnExample.js b/RNTester/js/examples/MultiColumn/MultiColumnExample.js index aa1ea81b136..601ddf67b12 100644 --- a/RNTester/js/examples/MultiColumn/MultiColumnExample.js +++ b/RNTester/js/examples/MultiColumn/MultiColumnExample.js @@ -110,7 +110,12 @@ class MultiColumnExample extends React.PureComponent< _getItemLayout( data: any, index: number, - ): {length: number, offset: number, index: number} { + ): { + length: number, + offset: number, + index: number, + ... + } { const length = getItemLayout(data, index).length + 2 * (CARD_MARGIN + BORDER_WIDTH); return {length, offset: length * index, index}; @@ -131,10 +136,12 @@ class MultiColumnExample extends React.PureComponent< changed: Array<{ key: string, isViewable: boolean, - item: {columns: Array<*>}, + item: {columns: Array<*>, ...}, index: ?number, section?: any, + ... }>, + ... }) => { // Impressions can be logged here if (this.state.logViewable) { diff --git a/RNTester/js/examples/NativeAnimation/NativeAnimationsExample.js b/RNTester/js/examples/NativeAnimation/NativeAnimationsExample.js index 01b6b077294..cd20cb7ca50 100644 --- a/RNTester/js/examples/NativeAnimation/NativeAnimationsExample.js +++ b/RNTester/js/examples/NativeAnimation/NativeAnimationsExample.js @@ -72,7 +72,7 @@ class Tester extends React.Component<$FlowFixMeProps, $FlowFixMeState> { } } -class ValueListenerExample extends React.Component<{}, $FlowFixMeState> { +class ValueListenerExample extends React.Component<{...}, $FlowFixMeState> { state = { anim: new Animated.Value(0), progress: 0, @@ -121,7 +121,7 @@ class ValueListenerExample extends React.Component<{}, $FlowFixMeState> { } } -class LoopExample extends React.Component<{}, $FlowFixMeState> { +class LoopExample extends React.Component<{...}, $FlowFixMeState> { state = { value: new Animated.Value(0), }; @@ -157,8 +157,12 @@ class LoopExample extends React.Component<{}, $FlowFixMeState> { const RNTesterSettingSwitchRow = require('../../components/RNTesterSettingSwitchRow'); class InternalSettings extends React.Component< - {}, - {busyTime: number | string, filteredStall: number}, + {...}, + { + busyTime: number | string, + filteredStall: number, + ... + }, > { _stallInterval: ?number; render() { @@ -220,7 +224,7 @@ class InternalSettings extends React.Component< } } -class EventExample extends React.Component<{}, $FlowFixMeState> { +class EventExample extends React.Component<{...}, $FlowFixMeState> { state = { anim: new Animated.Value(0), }; diff --git a/RNTester/js/examples/OrientationChange/OrientationChangeExample.js b/RNTester/js/examples/OrientationChange/OrientationChangeExample.js index 5375a68fd77..98e3de6348b 100644 --- a/RNTester/js/examples/OrientationChange/OrientationChangeExample.js +++ b/RNTester/js/examples/OrientationChange/OrientationChangeExample.js @@ -16,7 +16,7 @@ const {DeviceEventEmitter, Text, View} = require('react-native'); import type EmitterSubscription from '../../../../Libraries/vendor/emitter/EmitterSubscription'; -class OrientationChangeExample extends React.Component<{}, $FlowFixMeState> { +class OrientationChangeExample extends React.Component<{...}, $FlowFixMeState> { _orientationSubscription: EmitterSubscription; state = { diff --git a/RNTester/js/examples/PanResponder/PanResponderExample.js b/RNTester/js/examples/PanResponder/PanResponderExample.js index cc480520f33..db85851eb38 100644 --- a/RNTester/js/examples/PanResponder/PanResponderExample.js +++ b/RNTester/js/examples/PanResponder/PanResponderExample.js @@ -24,6 +24,7 @@ type CircleStyles = { backgroundColor?: string, left?: number, top?: number, + ... }; const CIRCLE_SIZE = 80; diff --git a/RNTester/js/examples/PermissionsAndroid/PermissionsExample.js b/RNTester/js/examples/PermissionsAndroid/PermissionsExample.js index 3e7b2f2b41b..09ad095380c 100644 --- a/RNTester/js/examples/PermissionsAndroid/PermissionsExample.js +++ b/RNTester/js/examples/PermissionsAndroid/PermissionsExample.js @@ -23,7 +23,7 @@ const { const Item = Picker.Item; -class PermissionsExample extends React.Component<{}, $FlowFixMeState> { +class PermissionsExample extends React.Component<{...}, $FlowFixMeState> { state = { permission: PermissionsAndroid.PERMISSIONS.CAMERA, hasPermission: 'Not Checked', diff --git a/RNTester/js/examples/Picker/PickerExample.js b/RNTester/js/examples/Picker/PickerExample.js index d43a7dd3cdf..7672b9ea420 100644 --- a/RNTester/js/examples/Picker/PickerExample.js +++ b/RNTester/js/examples/Picker/PickerExample.js @@ -16,11 +16,9 @@ const {Picker, StyleSheet, Text} = require('react-native'); const Item = Picker.Item; -type State = { - value: string | number, -}; +type State = {value: string | number, ...}; -class BasicPickerExample extends React.Component<{}, State> { +class BasicPickerExample extends React.Component<{...}, State> { state: State = { value: 'key1', }; @@ -39,7 +37,7 @@ class BasicPickerExample extends React.Component<{}, State> { } } -class DisabledPickerExample extends React.Component<{}, State> { +class DisabledPickerExample extends React.Component<{...}, State> { state: State = { value: 'key1', }; @@ -57,7 +55,7 @@ class DisabledPickerExample extends React.Component<{}, State> { } } -class DropdownPickerExample extends React.Component<{}, State> { +class DropdownPickerExample extends React.Component<{...}, State> { state: State = { value: 'key1', }; @@ -76,7 +74,7 @@ class DropdownPickerExample extends React.Component<{}, State> { } } -class PromptPickerExample extends React.Component<{}, State> { +class PromptPickerExample extends React.Component<{...}, State> { state: State = { value: 'key1', }; @@ -95,11 +93,9 @@ class PromptPickerExample extends React.Component<{}, State> { } } -type ColorState = { - color: string | number, -}; +type ColorState = {color: string | number, ...}; -class ColorPickerExample extends React.Component<{}, ColorState> { +class ColorPickerExample extends React.Component<{...}, ColorState> { state: ColorState = { color: 'red', }; diff --git a/RNTester/js/examples/Picker/PickerIOSExample.js b/RNTester/js/examples/Picker/PickerIOSExample.js index e71e03539a6..6993c7ad743 100644 --- a/RNTester/js/examples/Picker/PickerIOSExample.js +++ b/RNTester/js/examples/Picker/PickerIOSExample.js @@ -97,7 +97,7 @@ const CAR_MAKES_AND_MODELS = { }, }; -class PickerExample extends React.Component<{}, $FlowFixMeState> { +class PickerExample extends React.Component<{...}, $FlowFixMeState> { state = { carMake: 'cadillac', modelIndex: 3, @@ -142,7 +142,7 @@ class PickerExample extends React.Component<{}, $FlowFixMeState> { } } -class PickerStyleExample extends React.Component<{}, $FlowFixMeState> { +class PickerStyleExample extends React.Component<{...}, $FlowFixMeState> { state = { carMake: 'cadillac', modelIndex: 0, diff --git a/RNTester/js/examples/PointerEvents/PointerEventsExample.js b/RNTester/js/examples/PointerEvents/PointerEventsExample.js index 9862a03b658..fcca307e9ea 100644 --- a/RNTester/js/examples/PointerEvents/PointerEventsExample.js +++ b/RNTester/js/examples/PointerEvents/PointerEventsExample.js @@ -169,6 +169,7 @@ type ExampleClass = { Component: React.ComponentType, title: string, description: string, + ... }; const exampleClasses: Array = [ diff --git a/RNTester/js/examples/ProgressBarAndroid/ProgressBarAndroidExample.android.js b/RNTester/js/examples/ProgressBarAndroid/ProgressBarAndroidExample.android.js index 5024f2970d5..fde9562ed8f 100644 --- a/RNTester/js/examples/ProgressBarAndroid/ProgressBarAndroidExample.android.js +++ b/RNTester/js/examples/ProgressBarAndroid/ProgressBarAndroidExample.android.js @@ -19,18 +19,11 @@ const {ProgressBarAndroid: ProgressBar} = require('react-native'); import type {ProgressBarAndroidProps} from '../../../../Libraries/Components/ProgressBarAndroid/ProgressBarAndroid'; type MovingBarProps = $ReadOnly<{| - ...$Diff< - ProgressBarAndroidProps, - { - progress: ?number, - }, - >, + ...$Diff, indeterminate: false, |}>; -type MovingBarState = { - progress: number, -}; +type MovingBarState = {progress: number, ...}; class MovingBar extends React.Component { _intervalID: ?IntervalID = null; @@ -57,7 +50,7 @@ class MovingBar extends React.Component { } } -class ProgressBarAndroidExample extends React.Component<{}> { +class ProgressBarAndroidExample extends React.Component<{...}> { render(): React.Node { return ( diff --git a/RNTester/js/examples/PushNotificationIOS/PushNotificationIOSExample.js b/RNTester/js/examples/PushNotificationIOS/PushNotificationIOSExample.js index 31eea14aed3..c291a7a6e5e 100644 --- a/RNTester/js/examples/PushNotificationIOS/PushNotificationIOSExample.js +++ b/RNTester/js/examples/PushNotificationIOS/PushNotificationIOSExample.js @@ -34,7 +34,7 @@ class Button extends React.Component<$FlowFixMeProps> { } } -class NotificationExample extends React.Component<{}> { +class NotificationExample extends React.Component<{...}> { UNSAFE_componentWillMount() { PushNotificationIOS.addEventListener('register', this._onRegistered); PushNotificationIOS.addEventListener( diff --git a/RNTester/js/examples/RCTRootView/RCTRootViewIOSExample.js b/RNTester/js/examples/RCTRootView/RCTRootViewIOSExample.js index 222df450960..0ed34bcac5d 100644 --- a/RNTester/js/examples/RCTRootView/RCTRootViewIOSExample.js +++ b/RNTester/js/examples/RCTRootView/RCTRootViewIOSExample.js @@ -18,7 +18,7 @@ const { requireNativeComponent, } = require('react-native'); -class AppPropertiesUpdateExample extends React.Component<{}> { +class AppPropertiesUpdateExample extends React.Component<{...}> { render() { // Do not require this unless we are actually rendering. const UpdatePropertiesExampleView = requireNativeComponent( @@ -40,7 +40,7 @@ class AppPropertiesUpdateExample extends React.Component<{}> { } } -class RootViewSizeFlexibilityExample extends React.Component<{}> { +class RootViewSizeFlexibilityExample extends React.Component<{...}> { render() { // Do not require this unless we are actually rendering. const FlexibleSizeExampleView = requireNativeComponent( diff --git a/RNTester/js/examples/RTL/RTLExample.js b/RNTester/js/examples/RTL/RTLExample.js index 5bf3b8d06d4..2008ea0ca8a 100644 --- a/RNTester/js/examples/RTL/RTLExample.js +++ b/RNTester/js/examples/RTL/RTLExample.js @@ -32,16 +32,16 @@ type State = { pan: Object, linear: Object, isRTL: boolean, + ... }; -type RTLToggleState = { - isRTL: boolean, -}; +type RTLToggleState = {isRTL: boolean, ...}; type AnimationState = { toggleStatus: any, linear: Object, windowWidth: number, + ... }; const SCALE = PixelRatio.get(); diff --git a/RNTester/js/examples/RootViewSizeFlexibilityExample/RootViewSizeFlexibilityExampleApp.js b/RNTester/js/examples/RootViewSizeFlexibilityExample/RootViewSizeFlexibilityExampleApp.js index acd4f52733a..ccaf8e82b64 100644 --- a/RNTester/js/examples/RootViewSizeFlexibilityExample/RootViewSizeFlexibilityExampleApp.js +++ b/RNTester/js/examples/RootViewSizeFlexibilityExample/RootViewSizeFlexibilityExampleApp.js @@ -15,10 +15,10 @@ const React = require('react'); const {StyleSheet, Text, TouchableHighlight, View} = require('react-native'); class RootViewSizeFlexibilityExampleApp extends React.Component< - {toggled: boolean}, + {toggled: boolean, ...}, any, > { - constructor(props: {toggled: boolean}) { + constructor(props: {toggled: boolean, ...}) { super(props); this.state = {toggled: false}; } diff --git a/RNTester/js/examples/SafeAreaView/SafeAreaViewExample.js b/RNTester/js/examples/SafeAreaView/SafeAreaViewExample.js index b1bb6cf8f3a..a80d717b972 100644 --- a/RNTester/js/examples/SafeAreaView/SafeAreaViewExample.js +++ b/RNTester/js/examples/SafeAreaView/SafeAreaViewExample.js @@ -24,7 +24,7 @@ const { } = require('react-native'); class SafeAreaViewExample extends React.Component< - {}, + {...}, {| modalVisible: boolean, emulateUnlessSupported: boolean, @@ -83,7 +83,7 @@ class SafeAreaViewExample extends React.Component< } } -class IsIPhoneXExample extends React.Component<{}> { +class IsIPhoneXExample extends React.Component<{...}> { render() { return ( diff --git a/RNTester/js/examples/ScrollView/ScrollViewAnimatedExample.js b/RNTester/js/examples/ScrollView/ScrollViewAnimatedExample.js index a111dad80af..7321369fc4c 100644 --- a/RNTester/js/examples/ScrollView/ScrollViewAnimatedExample.js +++ b/RNTester/js/examples/ScrollView/ScrollViewAnimatedExample.js @@ -23,7 +23,7 @@ const { Dimensions, } = ReactNative; -class ScrollViewAnimatedExample extends Component<{}> { +class ScrollViewAnimatedExample extends Component<{...}> { _scrollViewPos = new Animated.Value(0); startAnimation: () => void = () => { diff --git a/RNTester/js/examples/ScrollView/ScrollViewExample.js b/RNTester/js/examples/ScrollView/ScrollViewExample.js index 4d2106d335c..c00ea24ea83 100644 --- a/RNTester/js/examples/ScrollView/ScrollViewExample.js +++ b/RNTester/js/examples/ScrollView/ScrollViewExample.js @@ -128,7 +128,7 @@ exports.examples = [ title: ' enable & disable\n', description: 'ScrollView scrolling behaviour can be disabled and enabled', render: function(): React.Node { - class EnableDisableList extends React.Component<{}, *> { + class EnableDisableList extends React.Component<{...}, *> { state = { scrollEnabled: true, }; @@ -172,7 +172,7 @@ if (Platform.OS === 'ios') { 'without causing the visible content to jump. Re-ordering is not supported.', render: function() { let itemCount = 6; - class AppendingList extends React.Component<{}, *> { + class AppendingList extends React.Component<{...}, *> { state = { /* $FlowFixMe(>=0.85.0 site=react_native_fb) This comment suppresses * an error found when Flow v0.85 was deployed. To see the error, diff --git a/RNTester/js/examples/ScrollView/ScrollViewSimpleExample.js b/RNTester/js/examples/ScrollView/ScrollViewSimpleExample.js index 0409560c04d..ae654006496 100644 --- a/RNTester/js/examples/ScrollView/ScrollViewSimpleExample.js +++ b/RNTester/js/examples/ScrollView/ScrollViewSimpleExample.js @@ -21,7 +21,7 @@ const { const NUM_ITEMS = 20; -class ScrollViewSimpleExample extends React.Component<{}> { +class ScrollViewSimpleExample extends React.Component<{...}> { makeItems: (nItems: number, styles: any) => Array = ( nItems: number, styles, diff --git a/RNTester/js/examples/SectionList/SectionListExample.js b/RNTester/js/examples/SectionList/SectionListExample.js index 193c9eb7da8..d3b895e6362 100644 --- a/RNTester/js/examples/SectionList/SectionListExample.js +++ b/RNTester/js/examples/SectionList/SectionListExample.js @@ -67,7 +67,7 @@ const CustomSeparatorComponent = ({highlighted, text}) => ( ); -class SectionListExample extends React.PureComponent<{}, $FlowFixMeState> { +class SectionListExample extends React.PureComponent<{...}, $FlowFixMeState> { state: | any | {| @@ -230,10 +230,12 @@ class SectionListExample extends React.PureComponent<{}, $FlowFixMeState> { changed: Array<{ key: string, isViewable: boolean, - item: {columns: Array<*>}, + item: {columns: Array<*>, ...}, index: ?number, section?: any, + ... }>, + ... }) => { // Impressions can be logged here if (this.state.logViewable) { diff --git a/RNTester/js/examples/SegmentedControlIOS/SegmentedControlIOSExample.js b/RNTester/js/examples/SegmentedControlIOS/SegmentedControlIOSExample.js index 64a277d727e..0c20da7b148 100644 --- a/RNTester/js/examples/SegmentedControlIOS/SegmentedControlIOSExample.js +++ b/RNTester/js/examples/SegmentedControlIOS/SegmentedControlIOSExample.js @@ -13,7 +13,7 @@ const React = require('react'); const {SegmentedControlIOS, Text, View, StyleSheet} = require('react-native'); -class BasicSegmentedControlExample extends React.Component<{}> { +class BasicSegmentedControlExample extends React.Component<{...}> { render() { return ( @@ -30,7 +30,7 @@ class BasicSegmentedControlExample extends React.Component<{}> { } } -class PreSelectedSegmentedControlExample extends React.Component<{}> { +class PreSelectedSegmentedControlExample extends React.Component<{...}> { render() { return ( @@ -42,7 +42,7 @@ class PreSelectedSegmentedControlExample extends React.Component<{}> { } } -class MomentarySegmentedControlExample extends React.Component<{}> { +class MomentarySegmentedControlExample extends React.Component<{...}> { render() { return ( @@ -54,7 +54,7 @@ class MomentarySegmentedControlExample extends React.Component<{}> { } } -class DisabledSegmentedControlExample extends React.Component<{}> { +class DisabledSegmentedControlExample extends React.Component<{...}> { render() { return ( @@ -70,7 +70,7 @@ class DisabledSegmentedControlExample extends React.Component<{}> { } } -class ColorSegmentedControlExample extends React.Component<{}> { +class ColorSegmentedControlExample extends React.Component<{...}> { render() { return ( @@ -94,7 +94,7 @@ class ColorSegmentedControlExample extends React.Component<{}> { } class EventSegmentedControlExample extends React.Component< - {}, + {...}, $FlowFixMeState, > { state = { diff --git a/RNTester/js/examples/Snapshot/SnapshotExample.js b/RNTester/js/examples/Snapshot/SnapshotExample.js index b9057124481..98378fc7a70 100644 --- a/RNTester/js/examples/Snapshot/SnapshotExample.js +++ b/RNTester/js/examples/Snapshot/SnapshotExample.js @@ -21,7 +21,7 @@ const { } = require('react-native'); const ScreenshotManager = NativeModules.ScreenshotManager; -class ScreenshotExample extends React.Component<{}, $FlowFixMeState> { +class ScreenshotExample extends React.Component<{...}, $FlowFixMeState> { state = { uri: undefined, }; diff --git a/RNTester/js/examples/Snapshot/SnapshotViewIOS.ios.js b/RNTester/js/examples/Snapshot/SnapshotViewIOS.ios.js index 4aa32fb4dc3..59eb16899e7 100644 --- a/RNTester/js/examples/Snapshot/SnapshotViewIOS.ios.js +++ b/RNTester/js/examples/Snapshot/SnapshotViewIOS.ios.js @@ -27,9 +27,7 @@ const RCTSnapshot = UIManager.getViewManagerConfig('RCTSnapshot') : View; type SnapshotReadyEvent = SyntheticEvent< - $ReadOnly<{ - testIdentifier: string, - }>, + $ReadOnly<{testIdentifier: string, ...}>, >; type Props = $ReadOnly<{| diff --git a/RNTester/js/examples/StatusBar/StatusBarExample.js b/RNTester/js/examples/StatusBar/StatusBarExample.js index 3180dc24911..60510df9db0 100644 --- a/RNTester/js/examples/StatusBar/StatusBarExample.js +++ b/RNTester/js/examples/StatusBar/StatusBarExample.js @@ -31,7 +31,7 @@ function getValue(values: Array, index: number): T { return values[index % values.length]; } -class StatusBarHiddenExample extends React.Component<{}, $FlowFixMeState> { +class StatusBarHiddenExample extends React.Component<{...}, $FlowFixMeState> { state = { animated: true, hidden: false, @@ -98,7 +98,7 @@ class StatusBarHiddenExample extends React.Component<{}, $FlowFixMeState> { } } -class StatusBarStyleExample extends React.Component<{}, $FlowFixMeState> { +class StatusBarStyleExample extends React.Component<{...}, $FlowFixMeState> { _barStyleIndex = 0; _onChangeBarStyle = () => { @@ -142,7 +142,7 @@ class StatusBarStyleExample extends React.Component<{}, $FlowFixMeState> { } class StatusBarNetworkActivityExample extends React.Component< - {}, + {...}, $FlowFixMeState, > { state = { @@ -180,7 +180,7 @@ class StatusBarNetworkActivityExample extends React.Component< } class StatusBarBackgroundColorExample extends React.Component< - {}, + {...}, $FlowFixMeState, > { state = { @@ -225,7 +225,10 @@ class StatusBarBackgroundColorExample extends React.Component< } } -class StatusBarTranslucentExample extends React.Component<{}, $FlowFixMeState> { +class StatusBarTranslucentExample extends React.Component< + {...}, + $FlowFixMeState, +> { state = { translucent: false, }; @@ -254,7 +257,7 @@ class StatusBarTranslucentExample extends React.Component<{}, $FlowFixMeState> { } } -class StatusBarStaticIOSExample extends React.Component<{}> { +class StatusBarStaticIOSExample extends React.Component<{...}> { render() { return ( @@ -317,7 +320,7 @@ class StatusBarStaticIOSExample extends React.Component<{}> { } } -class StatusBarStaticAndroidExample extends React.Component<{}> { +class StatusBarStaticAndroidExample extends React.Component<{...}> { render() { return ( @@ -387,7 +390,7 @@ class StatusBarStaticAndroidExample extends React.Component<{}> { } } -class ModalExample extends React.Component<{}, $FlowFixMeState> { +class ModalExample extends React.Component<{...}, $FlowFixMeState> { state = { modalVisible: false, }; diff --git a/RNTester/js/examples/Switch/SwitchExample.js b/RNTester/js/examples/Switch/SwitchExample.js index d1d81811b2b..ce825594e11 100644 --- a/RNTester/js/examples/Switch/SwitchExample.js +++ b/RNTester/js/examples/Switch/SwitchExample.js @@ -125,7 +125,7 @@ class DisabledSwitchExample extends React.Component< } } -class ColorSwitchExample extends React.Component<{}, $FlowFixMeState> { +class ColorSwitchExample extends React.Component<{...}, $FlowFixMeState> { state = { colorTrueSwitchIsOn: true, colorFalseSwitchIsOn: false, @@ -158,7 +158,7 @@ class ColorSwitchExample extends React.Component<{}, $FlowFixMeState> { } } -class EventSwitchExample extends React.Component<{}, $FlowFixMeState> { +class EventSwitchExample extends React.Component<{...}, $FlowFixMeState> { state = { eventSwitchIsOn: false, eventSwitchRegressionIsOn: true, diff --git a/RNTester/js/examples/Text/TextExample.android.js b/RNTester/js/examples/Text/TextExample.android.js index fc4a241ee23..796205352dd 100644 --- a/RNTester/js/examples/Text/TextExample.android.js +++ b/RNTester/js/examples/Text/TextExample.android.js @@ -27,7 +27,7 @@ class Entity extends React.Component<{|children: React.Node|}> { ); } } -class AttributeToggler extends React.Component<{}, $FlowFixMeState> { +class AttributeToggler extends React.Component<{...}, $FlowFixMeState> { state = {fontWeight: 'bold', fontSize: 15}; toggleWeight = () => { @@ -70,7 +70,7 @@ class AttributeToggler extends React.Component<{}, $FlowFixMeState> { } } -class TextExample extends React.Component<{}> { +class TextExample extends React.Component<{...}> { render(): React.Node { return ( diff --git a/RNTester/js/examples/Text/TextExample.ios.js b/RNTester/js/examples/Text/TextExample.ios.js index 8b28c6dfb26..a27e052d0b4 100644 --- a/RNTester/js/examples/Text/TextExample.ios.js +++ b/RNTester/js/examples/Text/TextExample.ios.js @@ -94,7 +94,7 @@ class Entity extends React.Component<$FlowFixMeProps> { } } -class AttributeToggler extends React.Component<{}, $FlowFixMeState> { +class AttributeToggler extends React.Component<{...}, $FlowFixMeState> { state = {fontWeight: 'bold', fontSize: 15}; toggleWeight = () => { diff --git a/RNTester/js/examples/TextInput/TextInputExample.android.js b/RNTester/js/examples/TextInput/TextInputExample.android.js index aec7240a9dc..e08b07630f9 100644 --- a/RNTester/js/examples/TextInput/TextInputExample.android.js +++ b/RNTester/js/examples/TextInput/TextInputExample.android.js @@ -21,7 +21,7 @@ const { Switch, } = require('react-native'); -class TextEventsExample extends React.Component<{}, $FlowFixMeState> { +class TextEventsExample extends React.Component<{...}, $FlowFixMeState> { state = { curText: '', prevText: '', @@ -179,7 +179,7 @@ class TokenizedTextExample extends React.Component< } } -class BlurOnSubmitExample extends React.Component<{}> { +class BlurOnSubmitExample extends React.Component<{...}> { focusNextField = nextField => { this.refs[nextField].focus(); }; @@ -260,6 +260,7 @@ type SelectionExampleState = { end?: number, |}>, value: string, + ... }; class SelectionExample extends React.Component< @@ -337,7 +338,7 @@ class SelectionExample extends React.Component< } } -class AutogrowingTextInputExample extends React.Component<{}> { +class AutogrowingTextInputExample extends React.Component<{...}> { constructor(props) { super(props); diff --git a/RNTester/js/examples/TextInput/TextInputExample.ios.js b/RNTester/js/examples/TextInput/TextInputExample.ios.js index a22e6a5f2ec..2454cbbbb2c 100644 --- a/RNTester/js/examples/TextInput/TextInputExample.ios.js +++ b/RNTester/js/examples/TextInput/TextInputExample.ios.js @@ -37,7 +37,7 @@ class WithLabel extends React.Component<$FlowFixMeProps> { } } -class TextEventsExample extends React.Component<{}, $FlowFixMeState> { +class TextEventsExample extends React.Component<{...}, $FlowFixMeState> { state = { curText: '', prevText: '', @@ -99,7 +99,7 @@ class TextEventsExample extends React.Component<{}, $FlowFixMeState> { } } -class TextInputAccessoryViewExample extends React.Component<{}, *> { +class TextInputAccessoryViewExample extends React.Component<{...}, *> { constructor(props) { super(props); this.state = {text: 'Placeholder Text'}; @@ -306,7 +306,7 @@ class TokenizedTextExample extends React.Component<$FlowFixMeProps, any> { } } -class BlurOnSubmitExample extends React.Component<{}> { +class BlurOnSubmitExample extends React.Component<{...}> { focusNextField = nextField => { this.refs[nextField].focus(); }; @@ -367,6 +367,7 @@ type SelectionExampleState = { end?: number, |}>, value: string, + ... }; class SelectionExample extends React.Component< diff --git a/RNTester/js/examples/Touchable/TouchableExample.js b/RNTester/js/examples/Touchable/TouchableExample.js index 3c5c876fbab..a687f13f1f0 100644 --- a/RNTester/js/examples/Touchable/TouchableExample.js +++ b/RNTester/js/examples/Touchable/TouchableExample.js @@ -30,7 +30,7 @@ import {useEffect, useRef, useState} from 'react'; const forceTouchAvailable = (Platform.OS === 'ios' && Platform.constants.forceTouchAvailable) || false; -class TouchableHighlightBox extends React.Component<{}, $FlowFixMeState> { +class TouchableHighlightBox extends React.Component<{...}, $FlowFixMeState> { state = { timesPressed: 0, }; @@ -77,7 +77,10 @@ class TouchableHighlightBox extends React.Component<{}, $FlowFixMeState> { } } -class TouchableWithoutFeedbackBox extends React.Component<{}, $FlowFixMeState> { +class TouchableWithoutFeedbackBox extends React.Component< + {...}, + $FlowFixMeState, +> { state = { timesPressed: 0, }; @@ -113,7 +116,7 @@ class TouchableWithoutFeedbackBox extends React.Component<{}, $FlowFixMeState> { } } -class TextOnPressBox extends React.Component<{}, $FlowFixMeState> { +class TextOnPressBox extends React.Component<{...}, $FlowFixMeState> { state = { timesPressed: 0, }; @@ -148,7 +151,7 @@ class TextOnPressBox extends React.Component<{}, $FlowFixMeState> { } } -class TouchableFeedbackEvents extends React.Component<{}, $FlowFixMeState> { +class TouchableFeedbackEvents extends React.Component<{...}, $FlowFixMeState> { state = { eventLog: [], }; @@ -188,7 +191,7 @@ class TouchableFeedbackEvents extends React.Component<{}, $FlowFixMeState> { }; } -class TouchableDelayEvents extends React.Component<{}, $FlowFixMeState> { +class TouchableDelayEvents extends React.Component<{...}, $FlowFixMeState> { state = { eventLog: [], }; @@ -229,7 +232,7 @@ class TouchableDelayEvents extends React.Component<{}, $FlowFixMeState> { }; } -class ForceTouchExample extends React.Component<{}, $FlowFixMeState> { +class ForceTouchExample extends React.Component<{...}, $FlowFixMeState> { state = { force: 0, }; @@ -263,7 +266,7 @@ class ForceTouchExample extends React.Component<{}, $FlowFixMeState> { } } -class TouchableHitSlop extends React.Component<{}, $FlowFixMeState> { +class TouchableHitSlop extends React.Component<{...}, $FlowFixMeState> { state = { timesPressed: 0, }; @@ -343,7 +346,7 @@ function TouchableNativeMethods() { ); } -class TouchableDisabled extends React.Component<{}> { +class TouchableDisabled extends React.Component<{...}> { render() { return ( diff --git a/RNTester/js/examples/TransparentHitTest/TransparentHitTestExample.js b/RNTester/js/examples/TransparentHitTest/TransparentHitTestExample.js index e4cdee4d784..5c1f50cae40 100644 --- a/RNTester/js/examples/TransparentHitTest/TransparentHitTestExample.js +++ b/RNTester/js/examples/TransparentHitTest/TransparentHitTestExample.js @@ -13,7 +13,7 @@ const React = require('react'); const {Text, View, TouchableOpacity, Alert} = require('react-native'); -class TransparentHitTestExample extends React.Component<{}> { +class TransparentHitTestExample extends React.Component<{...}> { render() { return ( diff --git a/RNTester/js/examples/TurboModule/SampleTurboModuleExample.js b/RNTester/js/examples/TurboModule/SampleTurboModuleExample.js index c72e49911d8..76871e57b54 100644 --- a/RNTester/js/examples/TurboModule/SampleTurboModuleExample.js +++ b/RNTester/js/examples/TurboModule/SampleTurboModuleExample.js @@ -22,7 +22,14 @@ import { import * as React from 'react'; type State = {| - testResults: {[string]: {type: string, value: mixed}}, + testResults: { + [string]: { + type: string, + value: mixed, + ... + }, + ..., + }, |}; class SampleTurboModuleExample extends React.Component<{||}, State> { diff --git a/RNTester/js/examples/XHR/XHRExampleAbortController.js b/RNTester/js/examples/XHR/XHRExampleAbortController.js index f869098cc3e..76db33f8a35 100644 --- a/RNTester/js/examples/XHR/XHRExampleAbortController.js +++ b/RNTester/js/examples/XHR/XHRExampleAbortController.js @@ -14,7 +14,7 @@ const React = require('react'); const {Alert, Button, View} = require('react-native'); -class XHRExampleAbortController extends React.Component<{}, {}> { +class XHRExampleAbortController extends React.Component<{...}, {...}> { _timeout: any; _submit(abortDelay) { diff --git a/RNTester/js/examples/XHR/XHRExampleBinaryUpload.js b/RNTester/js/examples/XHR/XHRExampleBinaryUpload.js index adf83002c50..9dfbe61da5d 100644 --- a/RNTester/js/examples/XHR/XHRExampleBinaryUpload.js +++ b/RNTester/js/examples/XHR/XHRExampleBinaryUpload.js @@ -49,7 +49,7 @@ That is my proper element. --Faust, JW Goethe `; -class XHRExampleBinaryUpload extends React.Component<{}, $FlowFixMeState> { +class XHRExampleBinaryUpload extends React.Component<{...}, $FlowFixMeState> { static handlePostTestServerUpload(xhr: XMLHttpRequest) { if (xhr.status !== 200) { Alert.alert( diff --git a/RNTester/js/examples/XHR/XHRExampleDownload.js b/RNTester/js/examples/XHR/XHRExampleDownload.js index 15bb9e3e30b..41c414c108c 100644 --- a/RNTester/js/examples/XHR/XHRExampleDownload.js +++ b/RNTester/js/examples/XHR/XHRExampleDownload.js @@ -46,7 +46,7 @@ class ProgressBar extends React.Component<$FlowFixMeProps> { } } -class XHRExampleDownload extends React.Component<{}, Object> { +class XHRExampleDownload extends React.Component<{...}, Object> { state: Object = { downloading: false, // set by onreadystatechange diff --git a/RNTester/js/utils/RNTesterActions.js b/RNTester/js/utils/RNTesterActions.js index bfa181b05ca..d92bea4161c 100644 --- a/RNTester/js/utils/RNTesterActions.js +++ b/RNTester/js/utils/RNTesterActions.js @@ -12,17 +12,14 @@ import type {RNTesterTheme} from '../components/RNTesterTheme'; -export type RNTesterBackAction = { - type: 'RNTesterBackAction', -}; +export type RNTesterBackAction = {type: 'RNTesterBackAction', ...}; -export type RNTesterListAction = { - type: 'RNTesterListAction', -}; +export type RNTesterListAction = {type: 'RNTesterListAction', ...}; export type RNTesterExampleAction = { type: 'RNTesterExampleAction', openExample: string, + ... }; export type RNTesterAction = diff --git a/RNTester/js/utils/RNTesterNavigationReducer.js b/RNTester/js/utils/RNTesterNavigationReducer.js index b406eabcf3a..ee8d9e273e4 100644 --- a/RNTester/js/utils/RNTesterNavigationReducer.js +++ b/RNTester/js/utils/RNTesterNavigationReducer.js @@ -12,9 +12,7 @@ const RNTesterList = require('./RNTesterList'); -export type RNTesterNavigationState = { - openExample: ?string, -}; +export type RNTesterNavigationState = {openExample: ?string, ...}; function RNTesterNavigationReducer( state: ?RNTesterNavigationState, diff --git a/RNTester/js/utils/RNTesterStatePersister.js b/RNTester/js/utils/RNTesterStatePersister.js index b42c521d550..20845267130 100644 --- a/RNTester/js/utils/RNTesterStatePersister.js +++ b/RNTester/js/utils/RNTesterStatePersister.js @@ -16,6 +16,7 @@ const {AsyncStorage} = require('react-native'); export type PassProps = { state: State, setState: (stateLamda: (state: State) => State) => void, + ... }; /** @@ -29,11 +30,12 @@ export type PassProps = { * usage. */ function createContainer( - Component: React.ComponentType}>, + Component: React.ComponentType, ...}>, spec: { cacheKeySuffix: (props: Props) => string, getInitialState: (props: Props) => State, version?: string, + ... }, ): React.ComponentType { return class ComponentWithPersistedState extends React.Component< diff --git a/ReactAndroid/src/androidTest/js/NativeIdTestModule.js b/ReactAndroid/src/androidTest/js/NativeIdTestModule.js index cf4a67fe040..e03ff5ea338 100644 --- a/ReactAndroid/src/androidTest/js/NativeIdTestModule.js +++ b/ReactAndroid/src/androidTest/js/NativeIdTestModule.js @@ -30,7 +30,7 @@ const { * - The app renders fine * - The nativeID property is passed to the native views */ -class NativeIdTestApp extends React.Component<{}> { +class NativeIdTestApp extends React.Component<{...}> { render(): React.Node { const uri = 'data:image/gif;base64,' + diff --git a/ReactCommon/hermes/inspector/tools/msggen/src/Converters.js b/ReactCommon/hermes/inspector/tools/msggen/src/Converters.js index 65706c84351..8bed26b8ca1 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/src/Converters.js +++ b/ReactCommon/hermes/inspector/tools/msggen/src/Converters.js @@ -18,7 +18,7 @@ export function toCppType(type: string): string { return type.substr(0, 1).toUpperCase() + type.substr(1); } -const jsTypeMappings: {[key: string]: string} = { +const jsTypeMappings: {[key: string]: string, ...} = { any: 'folly::dynamic', array: 'folly::dynamic', boolean: 'bool', diff --git a/flow/console.js b/flow/console.js index 4cb3f31f8cf..a3c431bc7ba 100644 --- a/flow/console.js +++ b/flow/console.js @@ -12,7 +12,12 @@ declare module 'console' { declare function assert(value: any, ...message: any): void; declare function dir( obj: Object, - options: {showHidden: boolean, depth: number, colors: boolean}, + options: { + showHidden: boolean, + depth: number, + colors: boolean, + ... + }, ): void; declare function error(...data: any): void; declare function info(...data: any): void; @@ -26,7 +31,12 @@ declare module 'console' { assert(value: any, ...message: any): void; dir( obj: Object, - options: {showHidden: boolean, depth: number, colors: boolean}, + options: { + showHidden: boolean, + depth: number, + colors: boolean, + ... + }, ): void; error(...data: any): void; info(...data: any): void; diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js index 7da2e19d6ae..65a4d1765a4 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js @@ -21,11 +21,10 @@ import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactN type OnChangeEvent = $ReadOnly<{| location: { - source: { - url: string, - }, + source: {url: string, ...}, x: Int32, y: Int32, + ... }, |}>; diff --git a/packages/react-native-codegen/src/CodegenSchema.js b/packages/react-native-codegen/src/CodegenSchema.js index 9f5f356fcc2..7d8375512b3 100644 --- a/packages/react-native-codegen/src/CodegenSchema.js +++ b/packages/react-native-codegen/src/CodegenSchema.js @@ -316,12 +316,12 @@ export type ComponentShape = $ReadOnly<{| export type SchemaType = $ReadOnly<{| modules: $ReadOnly<{ [module: string]: $ReadOnly<{| - components?: $ReadOnly<{ - [component: string]: ComponentShape, - }>, + components?: $ReadOnly<{[component: string]: ComponentShape, ...}>, nativeModules?: $ReadOnly<{ [nativeModule: string]: NativeModuleShape, + ..., }>, |}>, + ..., }>, |}>; diff --git a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js index 981621c24f4..76f029bc7be 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js +++ b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js @@ -23,6 +23,7 @@ type FilesOutput = Map; type ComponentCollection = $ReadOnly<{ [component: string]: ComponentShape, + ..., }>; const template = ` diff --git a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js index cbdba29cf16..104d4e9726f 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js +++ b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js @@ -31,6 +31,7 @@ type StructsMap = Map; type ComponentCollection = $ReadOnly<{ [component: string]: ComponentShape, + ..., }>; const template = ` diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleMm.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleMm.js index da252113ffc..bd3949b2fb8 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleMm.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleMm.js @@ -146,7 +146,7 @@ module.exports = { schema: SchemaType, moduleSpecName: string, ): FilesOutput { - const nativeModules: {[name: string]: NativeModuleShape} = Object.keys( + const nativeModules: {[name: string]: NativeModuleShape, ...} = Object.keys( schema.modules, ) .map(moduleName => { diff --git a/packages/react-native-codegen/src/parsers/flow/components/events.js b/packages/react-native-codegen/src/parsers/flow/components/events.js index cdeb7d7c08d..bb748d48eec 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/events.js +++ b/packages/react-native-codegen/src/parsers/flow/components/events.js @@ -212,6 +212,7 @@ type EventTypeAST = Object; type TypeMap = { // $FlowFixMe there's no flowtype for ASTs [string]: Object, + ..., }; function getEvents(