File tree Expand file tree Collapse file tree
test/fixtures/flow/regression
arrow-in-ternary-with-param-type-and-return-type-like
arrow-in-ternary-with-param-type-and-return-type Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2061,6 +2061,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
20612061 return node . operator === "=" ;
20622062
20632063 case "ParenthesizedExpression" :
2064+ case "TypeCastExpression" :
20642065 return this . isAssignable ( node . expression ) ;
20652066
20662067 case "MemberExpression" :
Original file line number Diff line number Diff line change 1+ test
2+ ? ( x : T ) : U => y
Original file line number Diff line number Diff line change 1+ {
2+ "type" : " File" ,
3+ "start" : 0 ,
4+ "end" : 23 ,
5+ "loc" : {
6+ "start" : {
7+ "line" : 1 ,
8+ "column" : 0
9+ },
10+ "end" : {
11+ "line" : 2 ,
12+ "column" : 18
13+ }
14+ },
15+ "program" : {
16+ "type" : " Program" ,
17+ "start" : 0 ,
18+ "end" : 23 ,
19+ "loc" : {
20+ "start" : {
21+ "line" : 1 ,
22+ "column" : 0
23+ },
24+ "end" : {
25+ "line" : 2 ,
26+ "column" : 18
27+ }
28+ },
29+ "sourceType" : " module" ,
30+ "interpreter" : null ,
31+ "body" : [
32+ {
33+ "type" : " ExpressionStatement" ,
34+ "start" : 0 ,
35+ "end" : 23 ,
36+ "loc" : {
37+ "start" : {
38+ "line" : 1 ,
39+ "column" : 0
40+ },
41+ "end" : {
42+ "line" : 2 ,
43+ "column" : 18
44+ }
45+ },
46+ "expression" : {
47+ "type" : " ConditionalExpression" ,
48+ "start" : 0 ,
49+ "end" : 23 ,
50+ "loc" : {
51+ "start" : {
52+ "line" : 1 ,
53+ "column" : 0
54+ },
55+ "end" : {
56+ "line" : 2 ,
57+ "column" : 18
58+ }
59+ },
60+ "test" : {
61+ "type" : " Identifier" ,
62+ "start" : 0 ,
63+ "end" : 4 ,
64+ "loc" : {
65+ "start" : {
66+ "line" : 1 ,
67+ "column" : 0
68+ },
69+ "end" : {
70+ "line" : 1 ,
71+ "column" : 4
72+ },
73+ "identifierName" : " test"
74+ },
75+ "name" : " test"
76+ },
77+ "consequent" : {
78+ "type" : " TypeCastExpression" ,
79+ "start" : 10 ,
80+ "end" : 14 ,
81+ "loc" : {
82+ "start" : {
83+ "line" : 2 ,
84+ "column" : 5
85+ },
86+ "end" : {
87+ "line" : 2 ,
88+ "column" : 9
89+ }
90+ },
91+ "expression" : {
92+ "type" : " Identifier" ,
93+ "start" : 10 ,
94+ "end" : 11 ,
95+ "loc" : {
96+ "start" : {
97+ "line" : 2 ,
98+ "column" : 5
99+ },
100+ "end" : {
101+ "line" : 2 ,
102+ "column" : 6
103+ },
104+ "identifierName" : " x"
105+ },
106+ "name" : " x"
107+ },
108+ "typeAnnotation" : {
109+ "type" : " TypeAnnotation" ,
110+ "start" : 11 ,
111+ "end" : 14 ,
112+ "loc" : {
113+ "start" : {
114+ "line" : 2 ,
115+ "column" : 6
116+ },
117+ "end" : {
118+ "line" : 2 ,
119+ "column" : 9
120+ }
121+ },
122+ "typeAnnotation" : {
123+ "type" : " GenericTypeAnnotation" ,
124+ "start" : 13 ,
125+ "end" : 14 ,
126+ "loc" : {
127+ "start" : {
128+ "line" : 2 ,
129+ "column" : 8
130+ },
131+ "end" : {
132+ "line" : 2 ,
133+ "column" : 9
134+ }
135+ },
136+ "typeParameters" : null ,
137+ "id" : {
138+ "type" : " Identifier" ,
139+ "start" : 13 ,
140+ "end" : 14 ,
141+ "loc" : {
142+ "start" : {
143+ "line" : 2 ,
144+ "column" : 8
145+ },
146+ "end" : {
147+ "line" : 2 ,
148+ "column" : 9
149+ },
150+ "identifierName" : " T"
151+ },
152+ "name" : " T"
153+ }
154+ }
155+ },
156+ "extra" : {
157+ "parenthesized" : true ,
158+ "parenStart" : 9
159+ }
160+ },
161+ "alternate" : {
162+ "type" : " ArrowFunctionExpression" ,
163+ "start" : 17 ,
164+ "end" : 23 ,
165+ "loc" : {
166+ "start" : {
167+ "line" : 2 ,
168+ "column" : 12
169+ },
170+ "end" : {
171+ "line" : 2 ,
172+ "column" : 18
173+ }
174+ },
175+ "id" : null ,
176+ "generator" : false ,
177+ "async" : false ,
178+ "params" : [
179+ {
180+ "type" : " Identifier" ,
181+ "start" : 17 ,
182+ "end" : 18 ,
183+ "loc" : {
184+ "start" : {
185+ "line" : 2 ,
186+ "column" : 12
187+ },
188+ "end" : {
189+ "line" : 2 ,
190+ "column" : 13
191+ },
192+ "identifierName" : " U"
193+ },
194+ "name" : " U"
195+ }
196+ ],
197+ "body" : {
198+ "type" : " Identifier" ,
199+ "start" : 22 ,
200+ "end" : 23 ,
201+ "loc" : {
202+ "start" : {
203+ "line" : 2 ,
204+ "column" : 17
205+ },
206+ "end" : {
207+ "line" : 2 ,
208+ "column" : 18
209+ },
210+ "identifierName" : " y"
211+ },
212+ "name" : " y"
213+ }
214+ }
215+ }
216+ }
217+ ],
218+ "directives" : []
219+ }
220+ }
Original file line number Diff line number Diff line change 1+ test
2+ ? ( x : T ) : U => y
3+ : z
You can’t perform that action at this time.
0 commit comments