Skip to content

Commit

Permalink
Merge pull request facebook#6957 from zpao/flow026
Browse files Browse the repository at this point in the history
Upgrade Flow
  • Loading branch information
zpao committed Jun 3, 2016
2 parents 6b3f11c + dd093fa commit d3b36d5
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 17 deletions.
5 changes: 4 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[ignore]

.*/examples/.*
.*/build/.*
.*/node_modules/y18n/.*
.*/__mocks__/.*
Expand All @@ -20,6 +21,8 @@ module.system=haste
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable

experimental.strict_type_args=true

munge_underscores=false

suppress_type=$FlowIssue
Expand All @@ -31,4 +34,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-4]\\|1[0-9]\\|[0-9
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy

[version]
^0.24.0
^0.26.0
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"eslint-plugin-react-internal": "file:eslint-rules",
"fbjs": "^0.8.1",
"fbjs-scripts": "^0.6.0",
"flow-bin": "^0.24.0",
"flow-bin": "^0.26.0",
"glob": "^6.0.1",
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
Expand Down
5 changes: 4 additions & 1 deletion src/renderers/native/NativeMethodsMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ if (__DEV__) {
* In the future, we should cleanup callbacks by cancelling them instead of
* using this.
*/
var mountSafeCallback = function(context: ReactComponent, callback: ?Function): any {
function mountSafeCallback(
context: ReactComponent<any, any, any>,
callback: ?Function
): any {
return function() {
if (!callback || (context.isMounted && !context.isMounted())) {
return undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/native/ReactNative.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var render = function(
element: ReactElement,
mountInto: number,
callback?: ?(() => void)
): ?ReactComponent {
): ?ReactComponent<any, any, any> {
return ReactNativeMount.renderComponent(element, mountInto, callback);
};

Expand Down
6 changes: 3 additions & 3 deletions src/renderers/native/ReactNativeAttributePayload.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,9 @@ function diffProperties(
// default: fallthrough case when nested properties are defined
removedKeys = null;
removedKeyCount = 0;
// $FlowFixMe - We think that attributeConfig is not
// CustomAttributeConfiguration at this point so we assume
// it must be AttributeConfiguration.
// We think that attributeConfig is not CustomAttributeConfiguration at
// this point so we assume it must be AttributeConfiguration.
// $FlowFixMe
updatePayload = diffNestedProperty(
updatePayload,
prevProp,
Expand Down
4 changes: 2 additions & 2 deletions src/renderers/native/ReactNativeMount.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ var ReactNativeMount = {
nextElement: ReactElement,
containerTag: number,
callback?: ?(() => void)
): ?ReactComponent {
): ?ReactComponent<any, any, any> {
var nextWrappedElement = new ReactElement(
TopLevelWrapper,
null,
Expand Down Expand Up @@ -237,7 +237,7 @@ var ReactNativeMount = {
* @see {ReactNativeMount.unmountComponentAtNode}
*/
unmountComponentFromNode: function(
instance: ReactComponent,
instance: ReactComponent<any, any, any>,
containerID: number
) {
// Call back into native to remove all of the subviews from this container
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/native/createReactNativeComponentClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var createReactNativeComponentClass = function(
Constructor.prototype = new ReactNativeBaseComponent(viewConfig);
Constructor.prototype.constructor = Constructor;

return ((Constructor: any): ReactClass);
return ((Constructor: any): ReactClass<any>);
};

module.exports = createReactNativeComponentClass;
2 changes: 1 addition & 1 deletion src/renderers/noop/ReactNoop.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var NoopRenderer = ReactFiberReconciler({

var ReactNoop = {

render(element : ReactElement) {
render(element : ReactElement<any>) {

NoopRenderer.mountNewRoot(element);

Expand Down
4 changes: 2 additions & 2 deletions src/renderers/shared/fiber/ReactChildFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function createSubsequentChild(parent : Fiber, previousSibling : Fiber, newChild

switch (newChildren.$$typeof) {
case REACT_ELEMENT_TYPE: {
const element = (newChildren : ReactElement);
const element = (newChildren : ReactElement<any>);
const child = ReactFiber.createFiberFromElement(element);
previousSibling.sibling = child;
child.parent = parent;
Expand Down Expand Up @@ -80,7 +80,7 @@ function createFirstChild(parent, newChildren) {

switch (newChildren.$$typeof) {
case REACT_ELEMENT_TYPE: {
const element = (newChildren : ReactElement);
const element = (newChildren : ReactElement<any>);
const child = ReactFiber.createFiberFromElement(element);
child.parent = parent;
return child;
Expand Down
4 changes: 2 additions & 2 deletions src/renderers/shared/fiber/ReactFiberReconciler.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type HostConfig<T, P, I> = {
type OpaqueID = {};

export type Reconciler = {
mountNewRoot(element : ReactElement) : OpaqueID;
mountNewRoot(element : ReactElement<any>) : OpaqueID;
};

module.exports = function<T, P, I>(config : HostConfig<T, P, I>) : Reconciler {
Expand Down Expand Up @@ -109,7 +109,7 @@ module.exports = function<T, P, I>(config : HostConfig<T, P, I>) : Reconciler {

return {

mountNewRoot(element : ReactElement) : OpaqueID {
mountNewRoot(element : ReactElement<any>) : OpaqueID {

ensureLowPriIsScheduled();

Expand Down
2 changes: 1 addition & 1 deletion src/renderers/shared/fiber/isomorphic/ReactTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import type { ReactCoroutine, ReactYield } from 'ReactCoroutine';

export type ReactNode = ReactElement | ReactCoroutine | ReactYield | ReactText | ReactFragment;
export type ReactNode = ReactElement<any> | ReactCoroutine | ReactYield | ReactText | ReactFragment;

export type ReactFragment = ReactEmpty | Iterable<ReactNode>;

Expand Down
2 changes: 1 addition & 1 deletion src/renderers/testing/ReactTestMount.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ var ReactHostMount = {

render: function(
nextElement: ReactElement
): ?ReactComponent {
): ?ReactElement<any, any, any> {
var nextWrappedElement = new ReactElement(
TopLevelWrapper,
null,
Expand Down

0 comments on commit d3b36d5

Please sign in to comment.