@samitouri / QOS-React-2 / commits / dd093faadf

Add <any> type args for ReactElement,Class,Component

Paul O’Shannessy committed Jun 3, 2016 at 12:46 UTC dd093faadfb742d676699adb1b06d225fbb9fb82
9 files changed +15 -12
src/renderers/native/NativeMethodsMixin.js
+4 -1
@@ -207,7 +207,10 @@ if (__DEV__) {
207 * In the future, we should cleanup callbacks by cancelling them instead of
208 * using this.
209 */
210 -var mountSafeCallback = function(context: ReactComponent, callback: ?Function): any {
210 +function mountSafeCallback(
211 + context: ReactComponent<any, any, any>,
212 + callback: ?Function
213 +): any {
214 return function() {
215 if (!callback || (context.isMounted && !context.isMounted())) {
216 return undefined;
src/renderers/native/ReactNative.js
+1 -1
@@ -28,7 +28,7 @@ var render = function(
28 element: ReactElement,
29 mountInto: number,
30 callback?: ?(() => void)
31 -): ?ReactComponent {
31 +): ?ReactComponent<any, any, any> {
32 return ReactNativeMount.renderComponent(element, mountInto, callback);
33 };
34
src/renderers/native/ReactNativeMount.js
+2 -2
@@ -101,7 +101,7 @@ var ReactNativeMount = {
101 nextElement: ReactElement,
102 containerTag: number,
103 callback?: ?(() => void)
104 - ): ?ReactComponent {
104 + ): ?ReactComponent<any, any, any> {
105 var nextWrappedElement = new ReactElement(
106 TopLevelWrapper,
107 null,
@@ -237,7 +237,7 @@ var ReactNativeMount = {
237 * @see {ReactNativeMount.unmountComponentAtNode}
238 */
239 unmountComponentFromNode: function(
240 - instance: ReactComponent,
240 + instance: ReactComponent<any, any, any>,
241 containerID: number
242 ) {
243 // Call back into native to remove all of the subviews from this container
src/renderers/native/createReactNativeComponentClass.js
+1 -1
@@ -42,7 +42,7 @@ var createReactNativeComponentClass = function(
42 Constructor.prototype = new ReactNativeBaseComponent(viewConfig);
43 Constructor.prototype.constructor = Constructor;
44
45 - return ((Constructor: any): ReactClass);
45 + return ((Constructor: any): ReactClass<any>);
46 };
47
48 module.exports = createReactNativeComponentClass;
src/renderers/noop/ReactNoop.js
+1 -1
@@ -40,7 +40,7 @@ var NoopRenderer = ReactFiberReconciler({
40
41 var ReactNoop = {
42
43 - render(element : ReactElement) {
43 + render(element : ReactElement<any>) {
44
45 NoopRenderer.mountNewRoot(element);
46
src/renderers/shared/fiber/ReactChildFiber.js
+2 -2
@@ -35,7 +35,7 @@ function createSubsequentChild(parent : Fiber, previousSibling : Fiber, newChild
35
36 switch (newChildren.$$typeof) {
37 case REACT_ELEMENT_TYPE: {
38 - const element = (newChildren : ReactElement);
38 + const element = (newChildren : ReactElement<any>);
39 const child = ReactFiber.createFiberFromElement(element);
40 previousSibling.sibling = child;
41 child.parent = parent;
@@ -80,7 +80,7 @@ function createFirstChild(parent, newChildren) {
80
81 switch (newChildren.$$typeof) {
82 case REACT_ELEMENT_TYPE: {
83 - const element = (newChildren : ReactElement);
83 + const element = (newChildren : ReactElement<any>);
84 const child = ReactFiber.createFiberFromElement(element);
85 child.parent = parent;
86 return child;
src/renderers/shared/fiber/ReactFiberReconciler.js
+2 -2
@@ -39,7 +39,7 @@ export type HostConfig<T, P, I> = {
39 type OpaqueID = {};
40
41 export type Reconciler = {
42 - mountNewRoot(element : ReactElement) : OpaqueID;
42 + mountNewRoot(element : ReactElement<any>) : OpaqueID;
43 };
44
45 module.exports = function<T, P, I>(config : HostConfig<T, P, I>) : Reconciler {
@@ -109,7 +109,7 @@ module.exports = function<T, P, I>(config : HostConfig<T, P, I>) : Reconciler {
109
110 return {
111
112 - mountNewRoot(element : ReactElement) : OpaqueID {
112 + mountNewRoot(element : ReactElement<any>) : OpaqueID {
113
114 ensureLowPriIsScheduled();
115
src/renderers/shared/fiber/isomorphic/ReactTypes.js
+1 -1
@@ -14,7 +14,7 @@
14
15 import type { ReactCoroutine, ReactYield } from 'ReactCoroutine';
16
17 -export type ReactNode = ReactElement | ReactCoroutine | ReactYield | ReactText | ReactFragment;
17 +export type ReactNode = ReactElement<any> | ReactCoroutine | ReactYield | ReactText | ReactFragment;
18
19 export type ReactFragment = ReactEmpty | Iterable<ReactNode>;
20
src/renderers/testing/ReactTestMount.js
+1 -1
@@ -96,7 +96,7 @@ var ReactHostMount = {
96
97 render: function(
98 nextElement: ReactElement
99 - ): ?ReactComponent {
99 + ): ?ReactElement<any, any, any> {
100 var nextWrappedElement = new ReactElement(
101 TopLevelWrapper,
102 null,