diff --git a/Libraries/Animated/src/Easing.js b/Libraries/Animated/src/Easing.js index ddd86557c5d637..6cad73c334ccbe 100644 --- a/Libraries/Animated/src/Easing.js +++ b/Libraries/Animated/src/Easing.js @@ -62,22 +62,14 @@ class Easing { /** * A stepping function, returns 1 for any positive value of `n`. */ - /* $FlowFixMe(>=0.59.0 site=react_native_fb) This comment suppresses an error - * caught by Flow 0.59 which was not caught before. Most likely, this error - * is because an exported function parameter is missing an annotation. - * Without an annotation, these parameters are uncovered by Flow. */ - static step0(n) { + static step0(n: number) { return n > 0 ? 1 : 0; } /** * A stepping function, returns 1 if `n` is greater than or equal to 1. */ - /* $FlowFixMe(>=0.59.0 site=react_native_fb) This comment suppresses an error - * caught by Flow 0.59 which was not caught before. Most likely, this error - * is because an exported function parameter is missing an annotation. - * Without an annotation, these parameters are uncovered by Flow. */ - static step1(n) { + static step1(n: number) { return n >= 1 ? 1 : 0; } @@ -87,11 +79,7 @@ class Easing { * * http://cubic-bezier.com/#0,0,1,1 */ - /* $FlowFixMe(>=0.59.0 site=react_native_fb) This comment suppresses an error - * caught by Flow 0.59 which was not caught before. Most likely, this error - * is because an exported function parameter is missing an annotation. - * Without an annotation, these parameters are uncovered by Flow. */ - static linear(t) { + static linear(t: number) { return t; } @@ -114,11 +102,7 @@ class Easing { * * http://easings.net/#easeInQuad */ - /* $FlowFixMe(>=0.59.0 site=react_native_fb) This comment suppresses an error - * caught by Flow 0.59 which was not caught before. Most likely, this error - * is because an exported function parameter is missing an annotation. - * Without an annotation, these parameters are uncovered by Flow. */ - static quad(t) { + static quad(t: number) { return t * t; } @@ -128,11 +112,7 @@ class Easing { * * http://easings.net/#easeInCubic */ - /* $FlowFixMe(>=0.59.0 site=react_native_fb) This comment suppresses an error - * caught by Flow 0.59 which was not caught before. Most likely, this error - * is because an exported function parameter is missing an annotation. - * Without an annotation, these parameters are uncovered by Flow. */ - static cubic(t) { + static cubic(t: number) { return t * t * t; } @@ -142,17 +122,8 @@ class Easing { * n = 4: http://easings.net/#easeInQuart * n = 5: http://easings.net/#easeInQuint */ - /* $FlowFixMe(>=0.59.0 site=react_native_fb) This comment suppresses an error - * caught by Flow 0.59 which was not caught before. Most likely, this error - * is because an exported function parameter is missing an annotation. - * Without an annotation, these parameters are uncovered by Flow. */ - static poly(n) { - /* $FlowFixMe(>=0.59.0 site=react_native_fb) This comment suppresses an - * error caught by Flow 0.59 which was not caught before. Most likely, this - * error is because an exported function parameter is missing an - * annotation. Without an annotation, these parameters are uncovered by - * Flow. */ - return (t) => Math.pow(t, n); + static poly(n: number) { + return (t: number) => Math.pow(t, n); } /** @@ -160,11 +131,7 @@ class Easing { * * http://easings.net/#easeInSine */ - /* $FlowFixMe(>=0.59.0 site=react_native_fb) This comment suppresses an error - * caught by Flow 0.59 which was not caught before. Most likely, this error - * is because an exported function parameter is missing an annotation. - * Without an annotation, these parameters are uncovered by Flow. */ - static sin(t) { + static sin(t: number) { return 1 - Math.cos(t * Math.PI / 2); } @@ -173,11 +140,7 @@ class Easing { * * http://easings.net/#easeInCirc */ - /* $FlowFixMe(>=0.59.0 site=react_native_fb) This comment suppresses an error - * caught by Flow 0.59 which was not caught before. Most likely, this error - * is because an exported function parameter is missing an annotation. - * Without an annotation, these parameters are uncovered by Flow. */ - static circle(t) { + static circle(t: number) { return 1 - Math.sqrt(1 - t * t); } @@ -186,11 +149,7 @@ class Easing { * * http://easings.net/#easeInExpo */ - /* $FlowFixMe(>=0.59.0 site=react_native_fb) This comment suppresses an error - * caught by Flow 0.59 which was not caught before. Most likely, this error - * is because an exported function parameter is missing an annotation. - * Without an annotation, these parameters are uncovered by Flow. */ - static exp(t) { + static exp(t: number) { return Math.pow(2, 10 * (t - 1)); } diff --git a/Libraries/CameraRoll/CameraRoll.js b/Libraries/CameraRoll/CameraRoll.js index 709532e04bfda9..78f8d365aaea24 100644 --- a/Libraries/CameraRoll/CameraRoll.js +++ b/Libraries/CameraRoll/CameraRoll.js @@ -35,6 +35,15 @@ const ASSET_TYPE_OPTIONS = { Photos: 'Photos', }; +type GetPhotosParams = { + first: number, + after?: string, + groupTypes?: $Keys, + groupName?: string, + assetType?: $Keys, + mimeTypes?: Array, +}; + /** * Shape of the param arg for the `getPhotos` function. */ @@ -73,6 +82,35 @@ const getPhotosParamChecker = createStrictShapeTypeChecker({ mimeTypes: PropTypes.arrayOf(PropTypes.string), }); +type GetPhotosReturn = Promise<{ + edges: Array<{ + node: { + type: string, + group_name: string, + image: { + uri: string, + height: number, + width: number, + isStored?: boolean, + playableDuration: number, + }, + timestamp: number, + location?: { + latitude?: number, + longitude?: number, + altitude?: number, + heading?: number, + speed?: number, + }, + }, + }>, + page_info: { + has_next_page: boolean, + start_cursor?: string, + end_cursor?: string, + }, +}>; + /** * Shape of the return value of the `getPhotos` function. */ @@ -162,8 +200,8 @@ class CameraRoll { invariant( type === 'photo' || type === 'video' || type === undefined, - // $FlowFixMe(>=0.28.0) - `The second argument to saveToCameraRoll must be 'photo' or 'video'. You passed ${type}`, + `The second argument to saveToCameraRoll must be 'photo' or 'video'. You passed ${type || + 'unknown'}`, ); let mediaType = 'photo'; @@ -259,11 +297,7 @@ class CameraRoll { * } * ``` */ - /* $FlowFixMe(>=0.59.0 site=react_native_fb) This comment suppresses an error - * caught by Flow 0.59 which was not caught before. Most likely, this error - * is because an exported function parameter is missing an annotation. - * Without an annotation, these parameters are uncovered by Flow. */ - static getPhotos(params) { + static getPhotos(params: GetPhotosParams): GetPhotosReturn { if (__DEV__) { checkPropTypes( {params: getPhotosParamChecker}, diff --git a/Libraries/StyleSheet/StyleSheetValidation.js b/Libraries/StyleSheet/StyleSheetValidation.js index d064f2bbe94be5..a1f63aa037e9a9 100644 --- a/Libraries/StyleSheet/StyleSheetValidation.js +++ b/Libraries/StyleSheet/StyleSheetValidation.js @@ -24,11 +24,7 @@ var invariant = require('fbjs/lib/invariant'); const ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; class StyleSheetValidation { - /* $FlowFixMe(>=0.59.0 site=react_native_fb) This comment suppresses an error - * caught by Flow 0.59 which was not caught before. Most likely, this error - * is because an exported function parameter is missing an annotation. - * Without an annotation, these parameters are uncovered by Flow. */ - static validateStyleProp(prop, style, caller) { + static validateStyleProp(prop: string, style: Object, caller: string) { if (!__DEV__) { return; } @@ -36,9 +32,6 @@ class StyleSheetValidation { var message1 = '"' + prop + '" is not a valid style property.'; var message2 = '\nValid style props: ' + JSON.stringify(Object.keys(allStylePropTypes).sort(), null, ' '); - /* $FlowFixMe(>=0.56.0 site=react_native_oss) This comment suppresses an - * error found when Flow v0.56 was deployed. To see the error delete this - * comment and run Flow. */ styleError(message1, style, caller, message2); } var error = allStylePropTypes[prop]( @@ -50,21 +43,11 @@ class StyleSheetValidation { ReactPropTypesSecret, ); if (error) { - /* $FlowFixMe(>=0.56.0 site=react_native_oss) This comment suppresses an - * error found when Flow v0.56 was deployed. To see the error delete this - * comment and run Flow. */ - /* $FlowFixMe(>=0.56.0 site=react_native_fb,react_native_oss) This - * comment suppresses an error found when Flow v0.56 was deployed. To see - * the error delete this comment and run Flow. */ styleError(error.message, style, caller); } } - /* $FlowFixMe(>=0.59.0 site=react_native_fb) This comment suppresses an error - * caught by Flow 0.59 which was not caught before. Most likely, this error - * is because an exported function parameter is missing an annotation. - * Without an annotation, these parameters are uncovered by Flow. */ - static validateStyle(name, styles) { + static validateStyle(name: string, styles: Object) { if (!__DEV__) { return; }