forked from facebook/flow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreact_16_3.exp
More file actions
114 lines (87 loc) · 5.17 KB
/
react_16_3.exp
File metadata and controls
114 lines (87 loc) · 5.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
Error ---------------------------------------------------------------------------------------------- forwardRef.js:12:12
Cannot create `FancyButton` element because property `foo` is missing in props [1] but exists in `Props` [2].
forwardRef.js:12:12
12| const _a = <FancyButton />; // Error, missing foo
^^^^^^^^^^^^^^^ [1]
References:
forwardRef.js:5:38
5| const FancyButton = React.forwardRef<Props, _>((props, ref) => (
^^^^^ [2]
Error ---------------------------------------------------------------------------------------------- forwardRef.js:14:12
Cannot create `FancyButton` element because property `bar` is missing in `Props` [1] but exists in props [2].
forwardRef.js:14:12
14| const _c = <FancyButton foo={3} bar={3} />; // Error bar, not allowed in exact props
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2]
References:
forwardRef.js:5:38
5| const FancyButton = React.forwardRef<Props, _>((props, ref) => (
^^^^^ [1]
Error ---------------------------------------------------------------------------------------------- forwardRef.js:20:12
Cannot create `FancyButton` element because in property `ref`:
- Either `HTMLDivElement` [1] is incompatible with `HTMLButtonElement` [2] in property `current`.
- Or a call signature declaring the expected parameter / return type is missing in object type [3] but exists in
function type [4].
forwardRef.js:20:12
20| const _e = <FancyButton foo={3} ref={badRef} />; // Incorrect ref type
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
References:
forwardRef.js:19:32
19| const badRef = React.createRef<HTMLDivElement>();
^^^^^^^^^^^^^^ [1]
<BUILTINS>/react-dom.js:290:44
290| button: ReactDOM$HTMLElementJSXIntrinsic<HTMLButtonElement, ReactDOM$HTMLElementProps>,
^^^^^^^^^^^^^^^^^ [2]
<BUILTINS>/react.js:240:6
240| ): {|current: null | T|};
^^^^^^^^^^^^^^^^^^^^^ [3]
<BUILTINS>/react.js:195:6
195| | ((React$ElementRef<ElementType> | null) => mixed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [4]
Error ---------------------------------------------------------------------------------------------- forwardRef.js:23:13
Cannot create `FancyButton` element because in property `ref`:
- Either property `current` is missing in function [1] but exists in object type [2].
- Or `HTMLDivElement` [3] is incompatible with `HTMLButtonElement` [4] in the first argument.
forwardRef.js:23:13
23| const _g = <FancyButton foo={3} ref={(x: null | HTMLDivElement) => x} />; // Incorrect ref type
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
References:
forwardRef.js:23:39
23| const _g = <FancyButton foo={3} ref={(x: null | HTMLDivElement) => x} />; // Incorrect ref type
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
<BUILTINS>/react.js:194:5
194| | {-current: React$ElementRef<ElementType> | null}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2]
forwardRef.js:23:50
23| const _g = <FancyButton foo={3} ref={(x: null | HTMLDivElement) => x} />; // Incorrect ref type
^^^^^^^^^^^^^^ [3]
<BUILTINS>/react-dom.js:290:44
290| button: ReactDOM$HTMLElementJSXIntrinsic<HTMLButtonElement, ReactDOM$HTMLElementProps>,
^^^^^^^^^^^^^^^^^ [4]
Error ---------------------------------------------------------------------------------------------- forwardRef.js:42:12
Cannot create `UnionRef` element because in property `ref`:
- Either `HTMLAnchorElement` [1] is incompatible with `HTMLButtonElement` [2] in property `current`.
- Or `HTMLAnchorElement` [1] is incompatible with `HTMLDivElement` [3] in property `current`.
- Or a call signature declaring the expected parameter / return type is missing in object type [4] but exists in
function type [5].
forwardRef.js:42:12
42| const _j = <UnionRef foo={3} ref={badUnionRef} />; // Error bad ref
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
References:
forwardRef.js:27:65
27| const UnionRef = React.forwardRef<FooProps, HTMLButtonElement | HTMLAnchorElement>(
^^^^^^^^^^^^^^^^^ [1]
forwardRef.js:41:37
41| const badUnionRef = React.createRef<HTMLButtonElement | HTMLDivElement>();
^^^^^^^^^^^^^^^^^ [2]
forwardRef.js:41:57
41| const badUnionRef = React.createRef<HTMLButtonElement | HTMLDivElement>();
^^^^^^^^^^^^^^ [3]
<BUILTINS>/react.js:240:6
240| ): {|current: null | T|};
^^^^^^^^^^^^^^^^^^^^^ [4]
<BUILTINS>/react.js:195:6
195| | ((React$ElementRef<ElementType> | null) => mixed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [5]
Found 5 errors
Only showing the most relevant union/intersection branches.
To see all branches, re-run Flow with --show-all-branches