Skip to content

Commit

Permalink
Fixed useCallback definition (and tests)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Nov 28, 2018
1 parent dabf49e commit 8df05bd
Show file tree
Hide file tree
Showing 10 changed files with 659 additions and 1,141 deletions.
4 changes: 2 additions & 2 deletions lib/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ declare module react {
inputs: ?$ReadOnlyArray<mixed>,
): void;

declare export function useCallback<T>(
callback: () => T | void,
declare export function useCallback<T: (...args: $ReadOnlyArray<empty>) => mixed>(
callback: T,
inputs: ?$ReadOnlyArray<mixed>,
): T;

Expand Down
18 changes: 4 additions & 14 deletions tests/getters_and_setters/getters_and_setters.exp
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,8 @@ References:
react.js:17:13
17| (<Example a="bad" />); // error: number ~> string
^^^^^ [1]
<<<<<<< HEAD
<BUILTINS>/react.js:404:36
404| number: React$PropType$Primitive<number>;
=======
<BUILTINS>/react.js:403:36
403| number: React$PropType$Primitive<number>;
>>>>>>> Add React.Suspense component and tests
<BUILTINS>/react.js:411:36
411| number: React$PropType$Primitive<number>;
^^^^^^ [2]


Expand All @@ -487,13 +482,8 @@ References:
react.js:18:20
18| (<Example a={0} c={0} />); // error: number ~> string
^ [1]
<<<<<<< HEAD
<BUILTINS>/react.js:406:36
406| string: React$PropType$Primitive<string>;
=======
<BUILTINS>/react.js:405:36
405| string: React$PropType$Primitive<string>;
>>>>>>> Add React.Suspense component and tests
<BUILTINS>/react.js:413:36
413| string: React$PropType$Primitive<string>;
^^^^^^ [2]


Expand Down
100 changes: 23 additions & 77 deletions tests/new_react/new_react.exp
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,8 @@ Cannot assign `this.props.x` to `_` because number [1] is incompatible with stri
^^^^^^^^^^^^

References:
<<<<<<< HEAD
<BUILTINS>/react.js:404:36
404| number: React$PropType$Primitive<number>;
=======
<BUILTINS>/react.js:403:36
403| number: React$PropType$Primitive<number>;
>>>>>>> Add React.Suspense component and tests
<BUILTINS>/react.js:411:36
411| number: React$PropType$Primitive<number>;
^^^^^^ [1]
classes.js:57:12
57| var _: string = this.props.x;
Expand Down Expand Up @@ -393,13 +388,8 @@ Cannot assign `this.props.z` to `qux` because:
^^^^^^^^^^^^

References:
<<<<<<< HEAD
<BUILTINS>/react.js:404:36
404| number: React$PropType$Primitive<number>;
=======
<BUILTINS>/react.js:403:36
403| number: React$PropType$Primitive<number>;
>>>>>>> Add React.Suspense component and tests
<BUILTINS>/react.js:411:36
411| number: React$PropType$Primitive<number>;
^^^^^^ [1]
new_react.js:19:18
19| var qux: string = this.props.z;
Expand All @@ -415,13 +405,8 @@ Cannot assign `this.props.x` to `w` because string [1] is incompatible with numb
^^^^^^^^^^^^

References:
<<<<<<< HEAD
<BUILTINS>/react.js:406:36
406| string: React$PropType$Primitive<string>;
=======
<BUILTINS>/react.js:405:36
405| string: React$PropType$Primitive<string>;
>>>>>>> Add React.Suspense component and tests
<BUILTINS>/react.js:413:36
413| string: React$PropType$Primitive<string>;
^^^^^^ [1]
new_react.js:20:15
20| var w:number = this.props.x;
Expand Down Expand Up @@ -454,13 +439,8 @@ References:
new_react.js:29:23
29| var element = <C x = {0}/>;
^ [1]
<<<<<<< HEAD
<BUILTINS>/react.js:406:36
406| string: React$PropType$Primitive<string>;
=======
<BUILTINS>/react.js:405:36
405| string: React$PropType$Primitive<string>;
>>>>>>> Add React.Suspense component and tests
<BUILTINS>/react.js:413:36
413| string: React$PropType$Primitive<string>;
^^^^^^ [2]


Expand Down Expand Up @@ -565,13 +545,8 @@ Cannot assign `this.props.x` to `a` because:
^^^^^^^^^^^^

References:
<<<<<<< HEAD
<BUILTINS>/react.js:406:36
406| string: React$PropType$Primitive<string>;
=======
<BUILTINS>/react.js:405:36
405| string: React$PropType$Primitive<string>;
>>>>>>> Add React.Suspense component and tests
<BUILTINS>/react.js:413:36
413| string: React$PropType$Primitive<string>;
^^^^^^ [1]
props.js:14:16
14| var a: number = this.props.x; // error
Expand Down Expand Up @@ -607,13 +582,8 @@ Cannot assign `this.props.z` to `c` because:
^^^^^^^^^^^^

References:
<<<<<<< HEAD
<BUILTINS>/react.js:404:36
404| number: React$PropType$Primitive<number>;
=======
<BUILTINS>/react.js:403:36
403| number: React$PropType$Primitive<number>;
>>>>>>> Add React.Suspense component and tests
<BUILTINS>/react.js:411:36
411| number: React$PropType$Primitive<number>;
^^^^^^ [1]
props.js:16:16
16| var c: string = this.props.z; // error
Expand All @@ -634,24 +604,14 @@ References:
props.js:20:29
20| var element = <TestProps x={false} y={false} z={false} />; // 3 errors
^^^^^ [1]
<<<<<<< HEAD
<BUILTINS>/react.js:406:36
406| string: React$PropType$Primitive<string>;
=======
<BUILTINS>/react.js:405:36
405| string: React$PropType$Primitive<string>;
>>>>>>> Add React.Suspense component and tests
<BUILTINS>/react.js:413:36
413| string: React$PropType$Primitive<string>;
^^^^^^ [2]
props.js:20:49
20| var element = <TestProps x={false} y={false} z={false} />; // 3 errors
^^^^^ [3]
<<<<<<< HEAD
<BUILTINS>/react.js:404:36
404| number: React$PropType$Primitive<number>;
=======
<BUILTINS>/react.js:403:36
403| number: React$PropType$Primitive<number>;
>>>>>>> Add React.Suspense component and tests
<BUILTINS>/react.js:411:36
411| number: React$PropType$Primitive<number>;
^^^^^^ [4]


Expand Down Expand Up @@ -708,13 +668,8 @@ References:
props2.js:9:41
9| getInitialState: function(): { bar: number } {
^^^^^^ [1]
<<<<<<< HEAD
<BUILTINS>/react.js:406:36
406| string: React$PropType$Primitive<string>;
=======
<BUILTINS>/react.js:405:36
405| string: React$PropType$Primitive<string>;
>>>>>>> Add React.Suspense component and tests
<BUILTINS>/react.js:413:36
413| string: React$PropType$Primitive<string>;
^^^^^^ [2]
props2.js:15:42
15| return <C {...this.state} foo = {0} />;
Expand Down Expand Up @@ -745,21 +700,12 @@ Cannot get `React.PropTypes.string.inRequired` because property `inRequired` is
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

References:
<<<<<<< HEAD
<BUILTINS>/react.js:380:39
<BUILTINS>/react.js:387:39
v
380| type ReactPropsChainableTypeChecker = {
381| isRequired: ReactPropsCheckType;
382| (props: any, propName: string, componentName: string, href?: string): ?Error;
383| };
=======
<BUILTINS>/react.js:379:39
v
379| type ReactPropsChainableTypeChecker = {
380| isRequired: ReactPropsCheckType;
381| (props: any, propName: string, componentName: string, href?: string): ?Error;
382| };
>>>>>>> Add React.Suspense component and tests
387| type ReactPropsChainableTypeChecker = {
388| isRequired: ReactPropsCheckType;
389| (props: any, propName: string, componentName: string, href?: string): ?Error;
390| };
^ [1]


Expand Down
Loading

0 comments on commit 8df05bd

Please sign in to comment.