@@ -262,6 +262,32 @@ function handleProperty(child: Node): Partial<Property> {
262262 } ;
263263}
264264
265+ function handleParam ( node : Node ) {
266+ const name = string ( node . values [ 0 ] ) ;
267+ let additionalTypes : string [ ] | undefined ;
268+
269+ for ( const child of node . children ) {
270+ switch ( child . name ) {
271+ case "additionalTypes" : {
272+ if ( additionalTypes ) {
273+ throw new Error ( "Unexpected multiple additionalTypes node" ) ;
274+ }
275+ additionalTypes = child . values . map ( string ) ;
276+ break ;
277+ }
278+ default :
279+ throw new Error ( `Unexpected child "${ child . name } " in param "${ name } "` ) ;
280+ }
281+ }
282+
283+ return {
284+ name,
285+ ...optionalMember ( "type" , "string" , node . properties ?. type ) ,
286+ ...optionalMember ( "overrideType" , "string" , node . properties ?. overrideType ) ,
287+ additionalTypes,
288+ } ;
289+ }
290+
265291/**
266292 * Handles a child node of type "method" and adds it to the method object.
267293 * @param child The child node to handle.
@@ -282,15 +308,7 @@ function handleMethod(child: Node): DeepPartial<OverridableMethod> {
282308 break ;
283309
284310 case "param" :
285- params . push ( {
286- name : string ( c . values [ 0 ] ) ,
287- ...optionalMember ( "type" , "string" , c . properties ?. type ) ,
288- ...optionalMember (
289- "overrideType" ,
290- "string" ,
291- c . properties ?. overrideType ,
292- ) ,
293- } ) ;
311+ params . push ( handleParam ( c ) ) ;
294312 break ;
295313
296314 default :
@@ -308,12 +326,9 @@ function handleMethod(child: Node): DeepPartial<OverridableMethod> {
308326 : null ;
309327
310328 const signatureIndex = child . properties ?. signatureIndex ;
311- if ( ( params . length || signatureIndex ) && ! type ) {
312- throw new Error ( "A method signature requires a type" ) ;
313- }
314329
315330 let signature : OverridableMethod [ "signature" ] = [ ] ;
316- if ( type ) {
331+ if ( type || params . length > 0 ) {
317332 // Determine the actual signature object
318333 const signatureObj : DeepPartial < Signature > = {
319334 param : params ,
0 commit comments