@@ -48,16 +48,15 @@ function string(arg: unknown): string {
4848 return arg ;
4949}
5050
51- function handleTyped ( type : Node ) : Typed {
51+ function handleTyped ( type : Node ) : DeepPartial < Typed > {
5252 const isTyped = type . name == "type" ;
5353 if ( ! isTyped ) {
5454 throw new Error ( "Expected a type node" ) ;
5555 }
56- const name = string ( type . values [ 0 ] ) ;
5756 const subType =
5857 type . children . length > 0 ? handleTyped ( type . children [ 0 ] ) : undefined ;
5958 return {
60- type : name ,
59+ ... optionalMember ( " type" , "string" , type . values [ 0 ] ) ,
6160 subtype : subType ,
6261 ...optionalMember ( "nullable" , "boolean" , type . properties ?. nullable ) ,
6362 } ;
@@ -167,8 +166,9 @@ function handleMixinAndInterfaces(
167166 const name = string ( node . properties ?. name || node . values [ 0 ] ) ;
168167
169168 const event : Event [ ] = [ ] ;
170- const property : Record < string , Partial < Property > > = { } ;
169+ const property : Record < string , DeepPartial < Property > > = { } ;
171170 let method : Record < string , DeepPartial < OverridableMethod > > = { } ;
171+ let typeParameters = { } ;
172172
173173 for ( const child of node . children ) {
174174 switch ( child . name ) {
@@ -188,12 +188,17 @@ function handleMixinAndInterfaces(
188188 } ) ;
189189 break ;
190190 }
191+ case "typeParameters" : {
192+ typeParameters = handleTypeParameters ( child ) ;
193+ break ;
194+ }
191195 default :
192196 throw new Error ( `Unknown node name: ${ child . name } ` ) ;
193197 }
194198 }
195199
196200 const interfaceObject = type === "interface" && {
201+ ...typeParameters ,
197202 ...optionalMember ( "exposed" , "string" , node . properties ?. exposed ) ,
198203 ...optionalMember ( "deprecated" , "string" , node . properties ?. deprecated ) ,
199204 ...optionalMember (
@@ -240,7 +245,7 @@ function handleEvent(child: Node): Event {
240245 * Handles a child node of type "property" and adds it to the property object.
241246 * @param child The child node to handle.
242247 */
243- function handleProperty ( child : Node ) : Partial < Property > {
248+ function handleProperty ( child : Node ) : DeepPartial < Property > {
244249 let typeNode : Node | undefined ;
245250 for ( const c of child . children ) {
246251 if ( c . name === "type" ) {
0 commit comments