@@ -765,7 +765,7 @@ export function emitWebIdl(
765765 }
766766
767767 function emitCallBackInterface ( i : Browser . Interface ) {
768- const methods = mapToArray ( i . methods . method ) ;
768+ const methods = mapToArray ( i . methods ? .method ) ;
769769 const m = methods [ 0 ] ;
770770 const overload = m . signature [ 0 ] ;
771771 const paramsString = overload . param ? paramsToString ( overload . param ) : "" ;
@@ -1284,14 +1284,21 @@ export function emitWebIdl(
12841284 return extendConflictsBaseTypes [ iName ] ? `${ iName } Base` : iName ;
12851285 }
12861286
1287+ function processExtends ( iName : string ) {
1288+ if ( allInterfacesMap [ iName ] ?. forward ) {
1289+ return allInterfacesMap [ iName ] . forward ;
1290+ }
1291+ return processIName ( iName ) ;
1292+ }
1293+
12871294 function processMixinName ( mixinName : string ) {
12881295 if ( allInterfacesMap [ mixinName ] . typeParameters ?. length === 1 ) {
12891296 return `${ mixinName } <${ i . name } >` ;
12901297 }
12911298 return mixinName ;
12921299 }
12931300
1294- const processedIName = processIName ( i . name ) ;
1301+ const processedIName = i . forward ?? processIName ( i . name ) ;
12951302
12961303 if ( processedIName !== i . name ) {
12971304 printer . printLineToStack (
@@ -1311,7 +1318,7 @@ export function emitWebIdl(
13111318 const finalExtends = [ i . extends || "Object" ]
13121319 . concat ( getImplementList ( i . name ) . map ( processMixinName ) )
13131320 . filter ( ( i ) => i !== "Object" )
1314- . map ( processIName ) ;
1321+ . map ( processExtends ) ;
13151322
13161323 if ( finalExtends . length ) {
13171324 printer . print ( ` extends ${ assertUnique ( finalExtends ) . join ( ", " ) } ` ) ;
@@ -1458,6 +1465,14 @@ export function emitWebIdl(
14581465 printer . printLine ( "}" ) ;
14591466 printer . printLine ( "" ) ;
14601467
1468+ if ( i . forward ) {
1469+ emitInterface ( {
1470+ name : i . name ,
1471+ extends : i . forwardExtends ,
1472+ constructor : undefined ,
1473+ } ) ;
1474+ }
1475+
14611476 if ( ! printer . stackIsEmpty ( ) ) {
14621477 printer . printStackContent ( ) ;
14631478 printer . printLine ( "}" ) ;
0 commit comments