File tree Expand file tree Collapse file tree 3 files changed +144
-1
lines changed
test/arrow-function_type_test_async_generic_empty_params Expand file tree Collapse file tree 3 files changed +144
-1
lines changed Original file line number Diff line number Diff line change @@ -466,6 +466,8 @@ export function tsPlugin(options?: {
466466 node . typeParameters = this . tsParseTypeParameters ( this . tsParseConstModifier ) ;
467467 // Don't use overloaded parseFunctionParams which would look for "<" again.
468468
469+ // Initialize params array before calling parseFunctionParams
470+ node . params = [ ] ;
469471 super . parseFunctionParams ( node ) ;
470472 node . returnType = this . tsTryParseTypeOrTypePredicateAnnotation ( ) ;
471473
@@ -481,7 +483,7 @@ export function tsPlugin(options?: {
481483
482484 return super . parseArrowExpression (
483485 res ,
484- /* params are already set */ null ,
486+ /* params are already set */ res . params ,
485487 /* async */ true ,
486488 /* forInit */ forInit
487489 ) ;
@@ -3229,6 +3231,10 @@ export function tsPlugin(options?: {
32293231 }
32303232
32313233 toAssignableList ( exprList : any [ ] , isBinding : boolean ) : any {
3234+ if ( ! exprList ) {
3235+ return exprList ; // Return null/undefined as-is
3236+ }
3237+
32323238 for ( let i = 0 ; i < exprList . length ; i ++ ) {
32333239 const expr = exprList [ i ] ;
32343240
Original file line number Diff line number Diff line change 1+ {
2+ "type" : " Program" ,
3+ "start" : 0 ,
4+ "end" : 46 ,
5+ "loc" : {
6+ "start" : {
7+ "line" : 1 ,
8+ "column" : 0
9+ },
10+ "end" : {
11+ "line" : 1 ,
12+ "column" : 46
13+ }
14+ },
15+ "body" : [
16+ {
17+ "type" : " VariableDeclaration" ,
18+ "start" : 0 ,
19+ "end" : 46 ,
20+ "loc" : {
21+ "start" : {
22+ "line" : 1 ,
23+ "column" : 0
24+ },
25+ "end" : {
26+ "line" : 1 ,
27+ "column" : 46
28+ }
29+ },
30+ "declarations" : [
31+ {
32+ "type" : " VariableDeclarator" ,
33+ "start" : 6 ,
34+ "end" : 45 ,
35+ "loc" : {
36+ "start" : {
37+ "line" : 1 ,
38+ "column" : 6
39+ },
40+ "end" : {
41+ "line" : 1 ,
42+ "column" : 45
43+ }
44+ },
45+ "id" : {
46+ "type" : " Identifier" ,
47+ "start" : 6 ,
48+ "end" : 25 ,
49+ "loc" : {
50+ "start" : {
51+ "line" : 1 ,
52+ "column" : 6
53+ },
54+ "end" : {
55+ "line" : 1 ,
56+ "column" : 25
57+ }
58+ },
59+ "name" : " loadDataWithGeneric"
60+ },
61+ "init" : {
62+ "type" : " ArrowFunctionExpression" ,
63+ "start" : 28 ,
64+ "end" : 45 ,
65+ "loc" : {
66+ "start" : {
67+ "line" : 1 ,
68+ "column" : 28
69+ },
70+ "end" : {
71+ "line" : 1 ,
72+ "column" : 45
73+ }
74+ },
75+ "typeParameters" : {
76+ "type" : " TSTypeParameterDeclaration" ,
77+ "start" : 34 ,
78+ "end" : 37 ,
79+ "loc" : {
80+ "start" : {
81+ "line" : 1 ,
82+ "column" : 34
83+ },
84+ "end" : {
85+ "line" : 1 ,
86+ "column" : 37
87+ }
88+ },
89+ "params" : [
90+ {
91+ "type" : " TSTypeParameter" ,
92+ "start" : 35 ,
93+ "end" : 36 ,
94+ "loc" : {
95+ "start" : {
96+ "line" : 1 ,
97+ "column" : 35
98+ },
99+ "end" : {
100+ "line" : 1 ,
101+ "column" : 36
102+ }
103+ },
104+ "name" : " T"
105+ }
106+ ]
107+ },
108+ "params" : [],
109+ "id" : null ,
110+ "expression" : false ,
111+ "generator" : false ,
112+ "async" : true ,
113+ "body" : {
114+ "type" : " BlockStatement" ,
115+ "start" : 43 ,
116+ "end" : 45 ,
117+ "loc" : {
118+ "start" : {
119+ "line" : 1 ,
120+ "column" : 43
121+ },
122+ "end" : {
123+ "line" : 1 ,
124+ "column" : 45
125+ }
126+ },
127+ "body" : []
128+ }
129+ }
130+ }
131+ ],
132+ "kind" : " const"
133+ }
134+ ],
135+ "sourceType" : " module"
136+ }
Original file line number Diff line number Diff line change 1+ const loadDataWithGeneric = async < T > ( ) => { } ;
You can’t perform that action at this time.
0 commit comments