File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -880,11 +880,14 @@ export function emitWebIdl(
880880 if ( p . optional ) {
881881 pType += " | undefined" ;
882882 }
883+ const propertyName = p . name . includes ( "-" ) ? `"${ p . name } "` : p . name ;
883884 const optionalModifier = ! p . optional || prefix ? "" : "?" ;
884885 const canPutForward =
885886 compilerBehavior . allowUnrelatedSetterType || ! p . readonly ;
886887 if ( ! prefix && canPutForward && p . putForwards ) {
887- printer . printLine ( `get ${ p . name } ${ optionalModifier } (): ${ pType } ;` ) ;
888+ printer . printLine (
889+ `get ${ propertyName } ${ optionalModifier } (): ${ pType } ;` ,
890+ ) ;
888891
889892 const forwardingProperty = getPropertyFromInterface (
890893 allInterfacesMap [ pType ] ,
@@ -898,12 +901,12 @@ export function emitWebIdl(
898901 setterType += ` | ${ pType } ` ;
899902 }
900903 printer . printLine (
901- `set ${ p . name } ${ optionalModifier } (${ p . putForwards } : ${ setterType } );` ,
904+ `set ${ propertyName } ${ optionalModifier } (${ p . putForwards } : ${ setterType } );` ,
902905 ) ;
903906 } else {
904907 const readOnlyModifier = p . readonly && prefix === "" ? "readonly " : "" ;
905908 printer . printLine (
906- `${ prefix } ${ readOnlyModifier } ${ p . name } ${ optionalModifier } : ${ pType } ;` ,
909+ `${ prefix } ${ readOnlyModifier } ${ propertyName } ${ optionalModifier } : ${ pType } ;` ,
907910 ) ;
908911 }
909912 }
You can’t perform that action at this time.
0 commit comments