Skip to content

Commit 8df05bd

Browse files
author
Brian Vaughn
committed
Fixed useCallback definition (and tests)
1 parent dabf49e commit 8df05bd

File tree

10 files changed

+659
-1141
lines changed

10 files changed

+659
-1141
lines changed

lib/react.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ declare module react {
323323
inputs: ?$ReadOnlyArray<mixed>,
324324
): void;
325325

326-
declare export function useCallback<T>(
327-
callback: () => T | void,
326+
declare export function useCallback<T: (...args: $ReadOnlyArray<empty>) => mixed>(
327+
callback: T,
328328
inputs: ?$ReadOnlyArray<mixed>,
329329
): T;
330330

tests/getters_and_setters/getters_and_setters.exp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -465,13 +465,8 @@ References:
465465
react.js:17:13
466466
17| (<Example a="bad" />); // error: number ~> string
467467
^^^^^ [1]
468-
<<<<<<< HEAD
469-
<BUILTINS>/react.js:404:36
470-
404| number: React$PropType$Primitive<number>;
471-
=======
472-
<BUILTINS>/react.js:403:36
473-
403| number: React$PropType$Primitive<number>;
474-
>>>>>>> Add React.Suspense component and tests
468+
<BUILTINS>/react.js:411:36
469+
411| number: React$PropType$Primitive<number>;
475470
^^^^^^ [2]
476471

477472

@@ -487,13 +482,8 @@ References:
487482
react.js:18:20
488483
18| (<Example a={0} c={0} />); // error: number ~> string
489484
^ [1]
490-
<<<<<<< HEAD
491-
<BUILTINS>/react.js:406:36
492-
406| string: React$PropType$Primitive<string>;
493-
=======
494-
<BUILTINS>/react.js:405:36
495-
405| string: React$PropType$Primitive<string>;
496-
>>>>>>> Add React.Suspense component and tests
485+
<BUILTINS>/react.js:413:36
486+
413| string: React$PropType$Primitive<string>;
497487
^^^^^^ [2]
498488

499489

tests/new_react/new_react.exp

Lines changed: 23 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,8 @@ Cannot assign `this.props.x` to `_` because number [1] is incompatible with stri
189189
^^^^^^^^^^^^
190190

191191
References:
192-
<<<<<<< HEAD
193-
<BUILTINS>/react.js:404:36
194-
404| number: React$PropType$Primitive<number>;
195-
=======
196-
<BUILTINS>/react.js:403:36
197-
403| number: React$PropType$Primitive<number>;
198-
>>>>>>> Add React.Suspense component and tests
192+
<BUILTINS>/react.js:411:36
193+
411| number: React$PropType$Primitive<number>;
199194
^^^^^^ [1]
200195
classes.js:57:12
201196
57| var _: string = this.props.x;
@@ -393,13 +388,8 @@ Cannot assign `this.props.z` to `qux` because:
393388
^^^^^^^^^^^^
394389

395390
References:
396-
<<<<<<< HEAD
397-
<BUILTINS>/react.js:404:36
398-
404| number: React$PropType$Primitive<number>;
399-
=======
400-
<BUILTINS>/react.js:403:36
401-
403| number: React$PropType$Primitive<number>;
402-
>>>>>>> Add React.Suspense component and tests
391+
<BUILTINS>/react.js:411:36
392+
411| number: React$PropType$Primitive<number>;
403393
^^^^^^ [1]
404394
new_react.js:19:18
405395
19| var qux: string = this.props.z;
@@ -415,13 +405,8 @@ Cannot assign `this.props.x` to `w` because string [1] is incompatible with numb
415405
^^^^^^^^^^^^
416406

417407
References:
418-
<<<<<<< HEAD
419-
<BUILTINS>/react.js:406:36
420-
406| string: React$PropType$Primitive<string>;
421-
=======
422-
<BUILTINS>/react.js:405:36
423-
405| string: React$PropType$Primitive<string>;
424-
>>>>>>> Add React.Suspense component and tests
408+
<BUILTINS>/react.js:413:36
409+
413| string: React$PropType$Primitive<string>;
425410
^^^^^^ [1]
426411
new_react.js:20:15
427412
20| var w:number = this.props.x;
@@ -454,13 +439,8 @@ References:
454439
new_react.js:29:23
455440
29| var element = <C x = {0}/>;
456441
^ [1]
457-
<<<<<<< HEAD
458-
<BUILTINS>/react.js:406:36
459-
406| string: React$PropType$Primitive<string>;
460-
=======
461-
<BUILTINS>/react.js:405:36
462-
405| string: React$PropType$Primitive<string>;
463-
>>>>>>> Add React.Suspense component and tests
442+
<BUILTINS>/react.js:413:36
443+
413| string: React$PropType$Primitive<string>;
464444
^^^^^^ [2]
465445

466446

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

567547
References:
568-
<<<<<<< HEAD
569-
<BUILTINS>/react.js:406:36
570-
406| string: React$PropType$Primitive<string>;
571-
=======
572-
<BUILTINS>/react.js:405:36
573-
405| string: React$PropType$Primitive<string>;
574-
>>>>>>> Add React.Suspense component and tests
548+
<BUILTINS>/react.js:413:36
549+
413| string: React$PropType$Primitive<string>;
575550
^^^^^^ [1]
576551
props.js:14:16
577552
14| var a: number = this.props.x; // error
@@ -607,13 +582,8 @@ Cannot assign `this.props.z` to `c` because:
607582
^^^^^^^^^^^^
608583

609584
References:
610-
<<<<<<< HEAD
611-
<BUILTINS>/react.js:404:36
612-
404| number: React$PropType$Primitive<number>;
613-
=======
614-
<BUILTINS>/react.js:403:36
615-
403| number: React$PropType$Primitive<number>;
616-
>>>>>>> Add React.Suspense component and tests
585+
<BUILTINS>/react.js:411:36
586+
411| number: React$PropType$Primitive<number>;
617587
^^^^^^ [1]
618588
props.js:16:16
619589
16| var c: string = this.props.z; // error
@@ -634,24 +604,14 @@ References:
634604
props.js:20:29
635605
20| var element = <TestProps x={false} y={false} z={false} />; // 3 errors
636606
^^^^^ [1]
637-
<<<<<<< HEAD
638-
<BUILTINS>/react.js:406:36
639-
406| string: React$PropType$Primitive<string>;
640-
=======
641-
<BUILTINS>/react.js:405:36
642-
405| string: React$PropType$Primitive<string>;
643-
>>>>>>> Add React.Suspense component and tests
607+
<BUILTINS>/react.js:413:36
608+
413| string: React$PropType$Primitive<string>;
644609
^^^^^^ [2]
645610
props.js:20:49
646611
20| var element = <TestProps x={false} y={false} z={false} />; // 3 errors
647612
^^^^^ [3]
648-
<<<<<<< HEAD
649-
<BUILTINS>/react.js:404:36
650-
404| number: React$PropType$Primitive<number>;
651-
=======
652-
<BUILTINS>/react.js:403:36
653-
403| number: React$PropType$Primitive<number>;
654-
>>>>>>> Add React.Suspense component and tests
613+
<BUILTINS>/react.js:411:36
614+
411| number: React$PropType$Primitive<number>;
655615
^^^^^^ [4]
656616

657617

@@ -708,13 +668,8 @@ References:
708668
props2.js:9:41
709669
9| getInitialState: function(): { bar: number } {
710670
^^^^^^ [1]
711-
<<<<<<< HEAD
712-
<BUILTINS>/react.js:406:36
713-
406| string: React$PropType$Primitive<string>;
714-
=======
715-
<BUILTINS>/react.js:405:36
716-
405| string: React$PropType$Primitive<string>;
717-
>>>>>>> Add React.Suspense component and tests
671+
<BUILTINS>/react.js:413:36
672+
413| string: React$PropType$Primitive<string>;
718673
^^^^^^ [2]
719674
props2.js:15:42
720675
15| return <C {...this.state} foo = {0} />;
@@ -745,21 +700,12 @@ Cannot get `React.PropTypes.string.inRequired` because property `inRequired` is
745700
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
746701

747702
References:
748-
<<<<<<< HEAD
749-
<BUILTINS>/react.js:380:39
703+
<BUILTINS>/react.js:387:39
750704
v
751-
380| type ReactPropsChainableTypeChecker = {
752-
381| isRequired: ReactPropsCheckType;
753-
382| (props: any, propName: string, componentName: string, href?: string): ?Error;
754-
383| };
755-
=======
756-
<BUILTINS>/react.js:379:39
757-
v
758-
379| type ReactPropsChainableTypeChecker = {
759-
380| isRequired: ReactPropsCheckType;
760-
381| (props: any, propName: string, componentName: string, href?: string): ?Error;
761-
382| };
762-
>>>>>>> Add React.Suspense component and tests
705+
387| type ReactPropsChainableTypeChecker = {
706+
388| isRequired: ReactPropsCheckType;
707+
389| (props: any, propName: string, componentName: string, href?: string): ?Error;
708+
390| };
763709
^ [1]
764710

765711

0 commit comments

Comments
 (0)