@@ -24,6 +24,7 @@ export class MethodsParser {
24
24
platform : null ,
25
25
name : obj [ CO . name ] ,
26
26
type : this . getType ( obj ) ,
27
+ // type: ['string'],
27
28
isStatic : this . isStatic ( obj ) ,
28
29
shortDescription : this . getShortDescription ( obj ) ,
29
30
description : this . getDescription ( obj )
@@ -63,6 +64,8 @@ export class MethodsParser {
63
64
return this . parseReference ( obj ) ;
64
65
} else if ( this . isArray ( obj [ CO . type ] ) ) {
65
66
return this . parseArray ( obj ) ;
67
+ } else if ( this . isTypeParameter ( obj [ CO . type ] ) ) {
68
+ return this . parseTypeParameter ( obj ) ;
66
69
}
67
70
}
68
71
@@ -126,8 +129,11 @@ export class MethodsParser {
126
129
parseReflection ( obj : any ) {
127
130
if ( obj [ CO . type ] [ CO . declaration ] [ CO . children ] && obj [ CO . type ] [ CO . declaration ] [ CO . children ] . length !== 0 ) {
128
131
return this . parseTypeFromReflectionChildren ( obj ) ;
129
- } else {
132
+ } else if ( obj [ CO . type ] [ CO . declaration ] [ CO . indexSignature ] &&
133
+ obj [ CO . type ] [ CO . declaration ] [ CO . indexSignature ] . length !== 0 ) {
130
134
return this . parseTypeFromReflectionIndexSignature ( obj ) ;
135
+ } else {
136
+ return this . parseTypeFromSignature ( obj ) ;
131
137
}
132
138
}
133
139
@@ -156,6 +162,24 @@ export class MethodsParser {
156
162
. replace ( / : / g, ': ' ) ;
157
163
}
158
164
165
+ parseTypeFromSignature ( obj : any ) {
166
+ const mainReturnedType : any = this . determineType ( obj [ CO . type ] [ CO . declaration ] [ CO . signatures ] [ 0 ] ) ;
167
+ let parameters : any [ ] = [ ] ;
168
+ obj [ CO . type ] [ CO . declaration ] [ CO . signatures ] [ 0 ] [ CO . parameters ] . forEach ( ( item : any ) => {
169
+ parameters . push ( item [ CO . name ] + ': ' + this . determineType ( item ) ) ;
170
+ } ) ;
171
+ let returnedTypePrepared : string = '' ;
172
+ parameters . forEach ( ( item : any ) => {
173
+ returnedTypePrepared += item . toString ( ) + ', ' ;
174
+ } ) ;
175
+
176
+ return ( '(' + returnedTypePrepared + ') => ' + mainReturnedType ) . replace ( / , \) / g, ')' ) ;
177
+ }
178
+
179
+ parseTypeParameter ( obj : any ) {
180
+ return obj [ CO . type ] [ CO . name ] ;
181
+ }
182
+
159
183
parseArray ( obj : any ) {
160
184
return obj [ CO . type ] [ CO . elementType ] [ CO . name ] + '[]' ;
161
185
}
@@ -195,4 +219,8 @@ export class MethodsParser {
195
219
isArray ( obj : any ) {
196
220
return obj [ CO . type ] === 'array' ;
197
221
}
222
+
223
+ isTypeParameter ( obj : any ) {
224
+ return obj [ CO . type ] === 'typeParameter' ;
225
+ }
198
226
}
0 commit comments