@@ -74,7 +74,7 @@ const typify = (type) => {
74
74
case 'float[]' :
75
75
return 'number[]'
76
76
case 'array' : {
77
- if ( innerType ) return `Array<${ innerType } >`
77
+ if ( innerType ) return `Array<${ typify ( innerType [ 0 ] ) } >`
78
78
debug ( 'Untyped "Array" as return type' . yellow )
79
79
return 'any[]'
80
80
}
@@ -105,10 +105,16 @@ const typify = (type) => {
105
105
return '(() => void)'
106
106
case 'promise' :
107
107
if ( innerType ) {
108
- return `Promise<${ innerType } >`
108
+ return `Promise<${ typify ( innerType [ 0 ] ) } >`
109
109
}
110
110
debug ( 'Promise with missing inner type, defaulting to any' )
111
111
return 'Promise<any>'
112
+ case 'record' :
113
+ if ( innerType && innerType . length === 2 ) {
114
+ return `Record<${ typify ( innerType [ 0 ] ) } , ${ typify ( innerType [ 1 ] ) } >`
115
+ }
116
+ debug ( 'Record with missing inner types, default to any' )
117
+ return 'Record<any, any>'
112
118
case 'url' :
113
119
return 'string'
114
120
case 'touchbaritem' :
@@ -196,7 +202,7 @@ const genMethodString = (paramInterfaces, module, moduleMethod, parameters, retu
196
202
if ( Array . isArray ( param . type ) ) {
197
203
param . type = param . type . map ( ( paramType ) => {
198
204
if ( paramType . typeName === 'Function' && param . parameters ) {
199
- return Object . assign ( { } , paramType , { typeName : genMethodString ( paramInterfaces , module , moduleMethod , param . parameters , param . returns || paramType . innerType ) } )
205
+ return Object . assign ( { } , paramType , { typeName : genMethodString ( paramInterfaces , module , moduleMethod , param . parameters , param . returns || ( paramType . innerType && paramType . innerType [ 0 ] ) ) } )
200
206
}
201
207
return paramType
202
208
} )
0 commit comments