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(
880
880
if ( p . optional ) {
881
881
pType += " | undefined" ;
882
882
}
883
+ const propertyName = p . name . includes ( "-" ) ? `"${ p . name } "` : p . name ;
883
884
const optionalModifier = ! p . optional || prefix ? "" : "?" ;
884
885
const canPutForward =
885
886
compilerBehavior . allowUnrelatedSetterType || ! p . readonly ;
886
887
if ( ! prefix && canPutForward && p . putForwards ) {
887
- printer . printLine ( `get ${ p . name } ${ optionalModifier } (): ${ pType } ;` ) ;
888
+ printer . printLine (
889
+ `get ${ propertyName } ${ optionalModifier } (): ${ pType } ;` ,
890
+ ) ;
888
891
889
892
const forwardingProperty = getPropertyFromInterface (
890
893
allInterfacesMap [ pType ] ,
@@ -898,12 +901,12 @@ export function emitWebIdl(
898
901
setterType += ` | ${ pType } ` ;
899
902
}
900
903
printer . printLine (
901
- `set ${ p . name } ${ optionalModifier } (${ p . putForwards } : ${ setterType } );` ,
904
+ `set ${ propertyName } ${ optionalModifier } (${ p . putForwards } : ${ setterType } );` ,
902
905
) ;
903
906
} else {
904
907
const readOnlyModifier = p . readonly && prefix === "" ? "readonly " : "" ;
905
908
printer . printLine (
906
- `${ prefix } ${ readOnlyModifier } ${ p . name } ${ optionalModifier } : ${ pType } ;` ,
909
+ `${ prefix } ${ readOnlyModifier } ${ propertyName } ${ optionalModifier } : ${ pType } ;` ,
907
910
) ;
908
911
}
909
912
}
You can’t perform that action at this time.
0 commit comments