diff --git a/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js b/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js index d0ae13c26..e3a179887 100644 --- a/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js +++ b/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js @@ -7,6 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule NativeModules + * @flow */ 'use strict'; diff --git a/Libraries/BatchedBridge/BatchedBridgedModules/RCTAlertManager.ios.js b/Libraries/BatchedBridge/BatchedBridgedModules/RCTAlertManager.ios.js index ddd1cc36c..409ecf5ca 100644 --- a/Libraries/BatchedBridge/BatchedBridgedModules/RCTAlertManager.ios.js +++ b/Libraries/BatchedBridge/BatchedBridgedModules/RCTAlertManager.ios.js @@ -7,6 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule RCTAlertManager + * @flow */ 'use strict'; diff --git a/Libraries/BatchedBridge/BatchedBridgedModules/RCTEventEmitter.js b/Libraries/BatchedBridge/BatchedBridgedModules/RCTEventEmitter.js index 5ac00588e..7f875946e 100644 --- a/Libraries/BatchedBridge/BatchedBridgedModules/RCTEventEmitter.js +++ b/Libraries/BatchedBridge/BatchedBridgedModules/RCTEventEmitter.js @@ -7,6 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule RCTEventEmitter + * @flow */ 'use strict'; diff --git a/Libraries/BatchedBridge/BatchedBridgedModules/RCTJSTimers.js b/Libraries/BatchedBridge/BatchedBridgedModules/RCTJSTimers.js index 595cdce57..08a126b00 100644 --- a/Libraries/BatchedBridge/BatchedBridgedModules/RCTJSTimers.js +++ b/Libraries/BatchedBridge/BatchedBridgedModules/RCTJSTimers.js @@ -7,6 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule RCTJSTimers + * @flow */ 'use strict'; diff --git a/Libraries/CameraRoll/CameraRoll.js b/Libraries/CameraRoll/CameraRoll.js index db74c4619..6acc949e5 100644 --- a/Libraries/CameraRoll/CameraRoll.js +++ b/Libraries/CameraRoll/CameraRoll.js @@ -7,6 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule CameraRoll + * @flow */ 'use strict'; @@ -28,7 +29,8 @@ var GROUP_TYPES_OPTIONS = [ 'SavedPhotos', // default ]; -deepFreezeAndThrowOnMutationInDev(GROUP_TYPES_OPTIONS); +// Flow treats Object and Array as disjoint types, currently. +deepFreezeAndThrowOnMutationInDev((GROUP_TYPES_OPTIONS: any)); /** * Shape of the param arg for the `getPhotos` function. diff --git a/Libraries/Device/RCTDeviceEventEmitter.js b/Libraries/Device/RCTDeviceEventEmitter.js index dce621933..586663e34 100644 --- a/Libraries/Device/RCTDeviceEventEmitter.js +++ b/Libraries/Device/RCTDeviceEventEmitter.js @@ -7,6 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule RCTDeviceEventEmitter + * @flow */ 'use strict'; diff --git a/Libraries/Geolocation/Geolocation.ios.js b/Libraries/Geolocation/Geolocation.ios.js index 4aae5ece8..eb33fbbbe 100644 --- a/Libraries/Geolocation/Geolocation.ios.js +++ b/Libraries/Geolocation/Geolocation.ios.js @@ -7,6 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule Geolocation + * @flow */ 'use strict'; @@ -33,7 +34,10 @@ var updatesEnabled = false; */ var Geolocation = { - getCurrentPosition: function(geo_success, geo_error, geo_options) { + getCurrentPosition: function( + geo_success: Function, + geo_error?: Function, + geo_options?: Object) { invariant( typeof geo_success === 'function', 'Must provide a valid geo_success callback.' @@ -45,7 +49,7 @@ var Geolocation = { ); }, - watchPosition: function(success, error, options) { + watchPosition: function(success: Function, error?: Function, options?: Object): number { if (!updatesEnabled) { RCTLocationObserver.startObserving(options || {}); updatesEnabled = true; @@ -64,15 +68,17 @@ var Geolocation = { return watchID; }, - clearWatch: function(watchID) { + clearWatch: function(watchID: number) { var sub = subscriptions[watchID]; if (!sub) { // Silently exit when the watchID is invalid or already cleared // This is consistent with timers return; } + sub[0].remove(); - sub[1] && sub[1].remove(); + // array element refinements not yet enabled in Flow + var sub1 = sub[1]; sub1 && sub1.remove(); subscriptions[watchID] = undefined; var noWatchers = true; for (var ii = 0; ii < subscriptions.length; ii++) { @@ -90,9 +96,12 @@ var Geolocation = { RCTLocationObserver.stopObserving(); updatesEnabled = false; for (var ii = 0; ii < subscriptions.length; ii++) { - if (subscriptions[ii]) { + var sub = subscriptions[ii]; + if (sub) { warning('Called stopObserving with existing subscriptions.'); - subscriptions[ii].remove(); + sub[0].remove(); + // array element refinements not yet enabled in Flow + var sub1 = sub[1]; sub1 && sub1.remove(); } } subscriptions = [];