File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 66 DetailedObjectType ,
77 ParsedDocumentationResult ,
88 DetailedFunctionType ,
9+ DocumentationTag ,
910} from '@electron/docs-parser' ;
1011import chalk from 'chalk' ;
1112const debug = d ( 'dynamic-param' ) ;
@@ -194,13 +195,16 @@ const flushParamInterfaces = (
194195 return paramPropertyType ;
195196 } ) ;
196197 }
198+ const isReadonly = ( paramProperty . additionalTags || [ ] ) . includes ( DocumentationTag . AVAILABILITY_READONLY )
199+ ? 'readonly '
200+ : '' ;
197201 if (
198202 ! Array . isArray ( paramProperty . type ) &&
199203 paramProperty . type . toLowerCase ( ) === 'function'
200204 ) {
201205 // FIXME: functionProp should slot in here perfectly
202206 paramAPI . push (
203- `${ paramProperty . name } ${
207+ `${ isReadonly } ${ paramProperty . name } ${
204208 utils . isOptional ( paramProperty ) ? '?' : ''
205209 } : ${ utils . genMethodString (
206210 DynamicParamInterfaces ,
@@ -211,7 +215,7 @@ const flushParamInterfaces = (
211215 ) ;
212216 } else {
213217 paramAPI . push (
214- `${ paramProperty . name } ${ utils . isOptional ( paramProperty ) ? '?' : '' } : ${ utils . typify (
218+ `${ isReadonly } ${ paramProperty . name } ${ utils . isOptional ( paramProperty ) ? '?' : '' } : ${ utils . typify (
215219 paramProperty ,
216220 ) } ;`,
217221 ) ;
Original file line number Diff line number Diff line change @@ -335,6 +335,14 @@ export const generateModuleDeclaration = (
335335 let type : string = '' ;
336336 if ( paramType . type === 'Object' ) {
337337 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+ } ) )
338346 }
339347
340348 const isStatic = isStaticVersion ? 'static ' : '' ;
You can’t perform that action at this time.
0 commit comments