Skip to content

Commit

Permalink
Update FBSource to use Flow 0.22
Browse files Browse the repository at this point in the history
Reviewed By: gabelevi

Differential Revision: D3021265

fb-gh-sync-id: f4c857505c1a7b6b813bcdccd629e595ef7a81af
shipit-source-id: f4c857505c1a7b6b813bcdccd629e595ef7a81af
  • Loading branch information
jeffmo authored and Facebook Github Bot 2 committed Mar 8, 2016
1 parent dc4d486 commit b473d49
Show file tree
Hide file tree
Showing 18 changed files with 93 additions and 16 deletions.
21 changes: 18 additions & 3 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion Examples/UIExplorer/ExampleTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

export type Example = {
title: string,
render: () => ?ReactElement<any, any, any>,
render: () => ?ReactElement<any>,
description?: string,
platform?: string;
};
Expand Down
2 changes: 1 addition & 1 deletion Examples/UIExplorer/PointerEventsExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ var BoxOnlyExample = React.createClass({
});

type ExampleClass = {
Component: ReactClass<any, any, any>,
Component: ReactClass<any>,
title: string,
description: string,
};
Expand Down
2 changes: 1 addition & 1 deletion Examples/UIExplorer/UIExplorerExampleList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Examples/UIExplorer/UIExplorerPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion Examples/UIExplorer/createExamplePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
1 change: 1 addition & 0 deletions Libraries/Animated/src/AnimatedImplementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ function _flush(rootNode: AnimatedValue): void {
}
}
findAnimatedStyles(rootNode);
/* $FlowFixMe(site=react_native) */
animatedStyles.forEach(animatedStyle => animatedStyle.update());
}

Expand Down
2 changes: 1 addition & 1 deletion Libraries/AppRegistry/AppRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if (__DEV__) {

var runnables = {};

type ComponentProvider = () => ReactClass<any, any, any>;
type ComponentProvider = () => ReactClass<any>;

type AppConfig = {
appKey: string;
Expand Down
2 changes: 1 addition & 1 deletion Libraries/NavigationExperimental/NavigationContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const NavigationAbstractPanResponder = require('NavigationAbstractPanResponder')

const clamp = require('clamp');

import {
import type {
NavigationActionCaller,
NavigationLayout,
NavigationPosition,
Expand Down
1 change: 1 addition & 0 deletions Libraries/Network/NetInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ const NetInfo = {
eventName: ChangeEventName,
handler: Function
): void {
/* $FlowFixMe(site=react_native) */
const listener = _isConnectedSubscriptions.get(handler);
NetInfo.removeEventListener(
eventName,
Expand Down
2 changes: 1 addition & 1 deletion Libraries/ReactIOS/renderApplication.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/ReactIOS/renderApplication.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/ReactIOS/verifyPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Libraries/ReactNative/createReactNativeComponentClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type ReactNativeBaseComponentViewConfig = {
*/
var createReactNativeComponentClass = function(
viewConfig: ReactNativeBaseComponentViewConfig
): ReactClass<any, any, any> {
): ReactClass<any> {
var Constructor = function(element) {
this._currentElement = element;

Expand Down
31 changes: 31 additions & 0 deletions flow/Map.js
Original file line number Diff line number Diff line change
@@ -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 changes: 26 additions & 0 deletions flow/Set.js
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions flow/react.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// temporary patches for React.Component and React.Element
declare var ReactComponent: typeof React$Component;
declare var ReactElement: typeof React$Element;

0 comments on commit b473d49

Please sign in to comment.