Update FBSource to use Flow 0.22

Reviewed By: gabelevi

Differential Revision: D3021265

fb-gh-sync-id: f4c857505c1a7b6b813bcdccd629e595ef7a81af
shipit-source-id: f4c857505c1a7b6b813bcdccd629e595ef7a81af
This commit is contained in:
Jeff Morrison 2016-03-08 12:38:52 -08:00 committed by Facebook Github Bot 2
parent dc4d4863a2
commit b473d496c4
18 changed files with 93 additions and 16 deletions

View File

@ -42,10 +42,25 @@
# Ignore Website
.*/website/.*
.*/node_modules/is-my-json-valid/test/.*\.json
.*/node_modules/iconv-lite/encodings/tables/.*\.json
.*/node_modules/y18n/test/.*\.json
.*/node_modules/spdx-license-ids/spdx-license-ids.json
.*/node_modules/spdx-exceptions/index.json
.*/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json
.*/node_modules/resolve/lib/core.json
.*/node_modules/jsonparse/samplejson/.*\.json
.*/node_modules/json5/test/.*\.json
.*/node_modules/ua-parser-js/test/.*\.json
.*/node_modules/builtin-modules/builtin-modules.json
.*/node_modules/binary-extensions/binary-extensions.json
.*/node_modules/url-regex/tlds.json
[include]
[libs]
Libraries/react-native/react-native-interface.js
flow/
[options]
module.system=haste
@ -62,9 +77,9 @@ suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-1]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-1]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-2]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-2]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
[version]
0.21.0
0.22.0

View File

@ -18,7 +18,7 @@
export type Example = {
title: string,
render: () => ?ReactElement<any, any, any>,
render: () => ?ReactElement<any>,
description?: string,
platform?: string;
};

View File

@ -182,7 +182,7 @@ var BoxOnlyExample = React.createClass({
});
type ExampleClass = {
Component: ReactClass<any, any, any>,
Component: ReactClass<any>,
title: string,
description: string,
};

View File

@ -157,7 +157,7 @@ class UIExplorerExampleList extends React.Component {
}
}
function makeRenderable(example: any): ReactClass<any, any, any> {
function makeRenderable(example: any): ReactClass<any> {
return example.examples ?
createExamplePage(null, example) :
example;

View File

@ -37,9 +37,9 @@ var UIExplorerPage = React.createClass({
var ContentWrapper;
var wrapperProps = {};
if (this.props.noScroll) {
ContentWrapper = (View: ReactClass<any, any, any>);
ContentWrapper = (View: ReactClass<any>);
} else {
ContentWrapper = (ScrollView: ReactClass<any, any, any>);
ContentWrapper = (ScrollView: ReactClass<any>);
wrapperProps.automaticallyAdjustContentInsets = !this.props.title;
wrapperProps.keyboardShouldPersistTaps = true;
wrapperProps.keyboardDismissMode = 'interactive';

View File

@ -29,7 +29,7 @@ var invariant = require('fbjs/lib/invariant');
import type { Example, ExampleModule } from 'ExampleTypes';
var createExamplePage = function(title: ?string, exampleModule: ExampleModule)
: ReactClass<any, any, any> {
: ReactClass<any> {
invariant(!!exampleModule.examples, 'The module must have examples');
var ExamplePage = React.createClass({

View File

@ -130,6 +130,7 @@ function _flush(rootNode: AnimatedValue): void {
}
}
findAnimatedStyles(rootNode);
/* $FlowFixMe(site=react_native) */
animatedStyles.forEach(animatedStyle => animatedStyle.update());
}

View File

@ -25,7 +25,7 @@ if (__DEV__) {
var runnables = {};
type ComponentProvider = () => ReactClass<any, any, any>;
type ComponentProvider = () => ReactClass<any>;
type AppConfig = {
appKey: string;

View File

@ -15,7 +15,7 @@ var React = require('React');
var NavigationRootContainer = require('NavigationRootContainer');
function createNavigationContainer(
Component: ReactClass<any, any, any>,
Component: ReactClass<any>,
): ReactClass {
class NavigationComponent extends React.Component {
render() {

View File

@ -12,7 +12,7 @@ const NavigationAbstractPanResponder = require('NavigationAbstractPanResponder')
const clamp = require('clamp');
import {
import type {
NavigationActionCaller,
NavigationLayout,
NavigationPosition,

View File

@ -222,6 +222,7 @@ const NetInfo = {
eventName: ChangeEventName,
handler: Function
): void {
/* $FlowFixMe(site=react_native) */
const listener = _isConnectedSubscriptions.get(handler);
NetInfo.removeEventListener(
eventName,

View File

@ -107,7 +107,7 @@ var AppContainer = React.createClass({
});
function renderApplication<D, P, S>(
RootComponent: ReactClass<D, P, S>,
RootComponent: ReactClass<P>,
initialProps: P,
rootTag: any
) {

View File

@ -66,7 +66,7 @@ var AppContainer = React.createClass({
});
function renderApplication<D, P, S>(
RootComponent: ReactClass<D, P, S>,
RootComponent: ReactClass<P>,
initialProps: P,
rootTag: any
) {

View File

@ -13,7 +13,7 @@
var ReactNativeStyleAttributes = require('ReactNativeStyleAttributes');
export type ComponentInterface = ReactClass<any, any, any> | {
export type ComponentInterface = ReactClass<any> | {
name?: string;
displayName?: string;
propTypes: Object;

View File

@ -27,7 +27,7 @@ type ReactNativeBaseComponentViewConfig = {
*/
var createReactNativeComponentClass = function(
viewConfig: ReactNativeBaseComponentViewConfig
): ReactClass<any, any, any> {
): ReactClass<any> {
var Constructor = function(element) {
this._currentElement = element;

31
flow/Map.js Normal file
View File

@ -0,0 +1,31 @@
// Copyright 2004-present Facebook. All Rights Reserved.
// @nolint
// These annotations are copy/pasted from the built-in Flow definitions for
// Native Map.
declare module "Map" {
// Use the name "MapPolyfill" so that we don't get confusing error
// messages about "Using Map instead of Map".
declare class MapPolyfill<K, V> {
@@iterator(): Iterator<[K, V]>;
constructor<Key, Value>(_: void): MapPolyfill<Key, Value>;
constructor<Key, Value>(_: null): MapPolyfill<Key, Value>;
constructor<Key, Value>(iterable: Array<[Key, Value]>): MapPolyfill<Key, Value>;
constructor<Key, Value>(iterable: Iterable<[Key, Value]>): MapPolyfill<Key, Value>;
clear(): void;
delete(key: K): boolean;
entries(): Iterator<[K, V]>;
forEach(callbackfn: (value: V, index: K, map: MapPolyfill<K, V>) => mixed, thisArg?: any): void;
get(key: K): V | void;
has(key: K): boolean;
keys(): Iterator<K>;
set(key: K, value: V): MapPolyfill<K, V>;
size: number;
values(): Iterator<V>;
}
// Don't "declare class exports" directly, otherwise in error messages our
// show up as "exports" instead of "Map" or "MapPolyfill".
declare var exports: typeof MapPolyfill;
}

26
flow/Set.js Normal file
View File

@ -0,0 +1,26 @@
// Copyright 2004-present Facebook. All Rights Reserved.
// @nolint
// These annotations are copy/pasted from the built-in Flow definitions for
// Native Set.
declare module "Set" {
// Use the name "SetPolyfill" so that we don't get confusing error
// messages about "Using Set instead of Set".
declare class SetPolyfill<T> {
@@iterator(): Iterator<T>;
add(value: T): SetPolyfill<T>;
clear(): void;
delete(value: T): boolean;
entries(): Iterator<[T, T]>;
forEach(callbackfn: (value: T, index: T, set: SetPolyfill<T>) => mixed, thisArg?: any): void;
has(value: T): boolean;
keys(): Iterator<T>;
size: number;
values(): Iterator<T>;
}
// Don't "declare class exports" directly, otherwise in error messages our
// show up as "exports" instead of "Set" or "SetPolyfill".
declare var exports: typeof SetPolyfill;
}

3
flow/react.js vendored Normal file
View File

@ -0,0 +1,3 @@
// temporary patches for React.Component and React.Element
declare var ReactComponent: typeof React$Component;
declare var ReactElement: typeof React$Element;