@@ -54,9 +54,7 @@ function handleSingleTypeNode(type: Node): DeepPartial<Typed> {
5454 throw new Error ( "Expected a type node" ) ;
5555 }
5656 const subType =
57- type . children . length > 0
58- ? handleSingleTypeNode ( type . children [ 0 ] )
59- : undefined ;
57+ type . children . length > 0 ? handleTyped ( type . children ) : undefined ;
6058 return {
6159 ...optionalMember ( "type" , "string" , type . values [ 0 ] ) ,
6260 subtype : subType ,
@@ -270,21 +268,15 @@ function handleEvent(child: Node): Event {
270268 * @param child The child node to handle.
271269 */
272270function handleProperty ( child : Node ) : DeepPartial < Property > {
273- let typeNode : Node | undefined ;
274- for ( const c of child . children ) {
275- if ( c . name === "type" ) {
276- typeNode = c ;
277- break ;
278- }
279- }
271+ const typeNodes = child . children . filter ( ( c ) => c . name === "type" ) ;
280272
281273 return {
282274 name : string ( child . values [ 0 ] ) ,
283275 ...optionalMember ( "exposed" , "string" , child . properties ?. exposed ) ,
284276 ...optionalMember ( "optional" , "boolean" , child . properties ?. optional ) ,
285277 ...optionalMember ( "overrideType" , "string" , child . properties ?. overrideType ) ,
286- ...( typeNode
287- ? handleSingleTypeNode ( typeNode )
278+ ...( typeNodes . length > 0
279+ ? handleTyped ( typeNodes , child . properties ?. type )
288280 : optionalMember ( "type" , "string" , child . properties ?. type ) ) ,
289281 ...optionalMember ( "readonly" , "boolean" , child . properties ?. readonly ) ,
290282 ...optionalMember ( "deprecated" , "string" , child . properties ?. deprecated ) ,
0 commit comments