@@ -48,30 +48,30 @@ function string(arg: unknown): string {
4848 return arg ;
4949}
5050
51- function handleTyped ( type : Node ) : DeepPartial < Typed > {
51+ function handleSingleTypeNode ( type : Node ) : DeepPartial < Typed > {
5252 const isTyped = type . name == "type" ;
5353 if ( ! isTyped ) {
5454 throw new Error ( "Expected a type node" ) ;
5555 }
5656 const subType =
57- type . children . length > 0 ? handleTyped ( type . children [ 0 ] ) : undefined ;
57+ type . children . length > 0 ? handleSingleTypeNode ( type . children [ 0 ] ) : undefined ;
5858 return {
5959 ...optionalMember ( "type" , "string" , type . values [ 0 ] ) ,
6060 subtype : subType ,
6161 ...optionalMember ( "nullable" , "boolean" , type . properties ?. nullable ) ,
6262 } ;
6363}
6464
65- function handleMultipleTypes (
65+ function handleTyped (
6666 typeNodes : Node [ ] ,
6767 returns ?: Value ,
68- ) : DeepPartial < Typed > | DeepPartial < Typed > [ ] | undefined {
68+ ) : DeepPartial < Typed > | undefined {
6969 // Support multiple types, merged into array. If only one, keep as object.
70- let type : DeepPartial < Typed > | DeepPartial < Typed > [ ] | undefined ;
70+ let type : DeepPartial < Typed > | undefined ;
7171 if ( typeNodes . length === 1 ) {
72- type = handleTyped ( typeNodes [ 0 ] ) ;
72+ type = handleSingleTypeNode ( typeNodes [ 0 ] ) ;
7373 } else if ( typeNodes . length > 1 ) {
74- const types = typeNodes . map ( handleTyped ) ;
74+ const types = typeNodes . map ( handleSingleTypeNode ) ;
7575 type = { type : types } ;
7676 } else if ( returns ) {
7777 type = {
@@ -282,7 +282,7 @@ function handleProperty(child: Node): DeepPartial<Property> {
282282 ...optionalMember ( "optional" , "boolean" , child . properties ?. optional ) ,
283283 ...optionalMember ( "overrideType" , "string" , child . properties ?. overrideType ) ,
284284 ...( typeNode
285- ? handleTyped ( typeNode )
285+ ? handleSingleTypeNode ( typeNode )
286286 : optionalMember ( "type" , "string" , child . properties ?. type ) ) ,
287287 ...optionalMember ( "readonly" , "boolean" , child . properties ?. readonly ) ,
288288 ...optionalMember ( "deprecated" , "string" , child . properties ?. deprecated ) ,
@@ -342,7 +342,7 @@ function handleMethod(child: Node): DeepPartial<OverridableMethod> {
342342 }
343343
344344 const signatureIndex = child . properties ?. signatureIndex ;
345- const type = handleMultipleTypes ( typeNodes , child . properties ?. returns ) ;
345+ const type = handleTyped ( typeNodes , child . properties ?. returns ) ;
346346
347347 let signature : OverridableMethod [ "signature" ] = [ ] ;
348348 if ( type || params . length > 0 ) {
0 commit comments