File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 6
6
DetailedObjectType ,
7
7
ParsedDocumentationResult ,
8
8
DetailedFunctionType ,
9
+ DocumentationTag ,
9
10
} from '@electron/docs-parser' ;
10
11
import chalk from 'chalk' ;
11
12
const debug = d ( 'dynamic-param' ) ;
@@ -194,13 +195,16 @@ const flushParamInterfaces = (
194
195
return paramPropertyType ;
195
196
} ) ;
196
197
}
198
+ const isReadonly = ( paramProperty . additionalTags || [ ] ) . includes ( DocumentationTag . AVAILABILITY_READONLY )
199
+ ? 'readonly '
200
+ : '' ;
197
201
if (
198
202
! Array . isArray ( paramProperty . type ) &&
199
203
paramProperty . type . toLowerCase ( ) === 'function'
200
204
) {
201
205
// FIXME: functionProp should slot in here perfectly
202
206
paramAPI . push (
203
- `${ paramProperty . name } ${
207
+ `${ isReadonly } ${ paramProperty . name } ${
204
208
utils . isOptional ( paramProperty ) ? '?' : ''
205
209
} : ${ utils . genMethodString (
206
210
DynamicParamInterfaces ,
@@ -211,7 +215,7 @@ const flushParamInterfaces = (
211
215
) ;
212
216
} else {
213
217
paramAPI . push (
214
- `${ paramProperty . name } ${ utils . isOptional ( paramProperty ) ? '?' : '' } : ${ utils . typify (
218
+ `${ isReadonly } ${ paramProperty . name } ${ utils . isOptional ( paramProperty ) ? '?' : '' } : ${ utils . typify (
215
219
paramProperty ,
216
220
) } ;`,
217
221
) ;
Original file line number Diff line number Diff line change @@ -335,6 +335,14 @@ export const generateModuleDeclaration = (
335
335
let type : string = '' ;
336
336
if ( paramType . type === 'Object' ) {
337
337
type = DynamicParamInterfaces . createParamInterface ( p as any , '' ) ;
338
+ } else if ( Array . isArray ( paramType . type ) ) {
339
+ paramType . type = paramType . type . map ( t => t . type !== 'Object' ? t : ( {
340
+ ...t ,
341
+ type : DynamicParamInterfaces . createParamInterface ( {
342
+ ...p ,
343
+ type : t ,
344
+ } as any , '' ) ,
345
+ } ) )
338
346
}
339
347
340
348
const isStatic = isStaticVersion ? 'static ' : '' ;
You can’t perform that action at this time.
0 commit comments