diff --git a/src/bindings.py b/src/bindings.py index 72b49c70..d5cffe90 100644 --- a/src/bindings.py +++ b/src/bindings.py @@ -599,9 +599,10 @@ def processOverloadedConstructors(self, theClass, children = None, templateDecl def processEnum(self, theEnum): output = "" - bindingsOutput = "export declare type " + theEnum.spelling + " = {\n" + bindingsOutput = "export declare type " + theEnum.spelling + " = { value: unique symbol };\n" + bindingsOutput += "export declare type " + theEnum.spelling + "_Vals = {\n" for enumChild in list(theEnum.get_children()): - bindingsOutput += " " + enumChild.spelling + ": {};\n" + bindingsOutput += " " + enumChild.spelling + ": " + theEnum.spelling + ";\n" bindingsOutput += "}\n\n" output += bindingsOutput self.exports.append(theEnum.spelling) diff --git a/src/buildFromYaml.py b/src/buildFromYaml.py index 19ede080..b9669c50 100755 --- a/src/buildFromYaml.py +++ b/src/buildFromYaml.py @@ -293,7 +293,7 @@ def getAdditionalBindCodeO(): " }\n" + \ " function analyzePath(path: string): AnalysisResults;\n" + \ "}\n\n" + \ - "\nexport type OpenCascadeInstance = {FS: typeof FS} & {\n " + ";\n ".join(map(lambda x: x["export"] + ((": typeof " + x["export"]) if x["kind"] == "class" else (": " + x["export"])), typescriptExports)) + ";\n" + \ + "\nexport type OpenCascadeInstance = {FS: typeof FS} & {\n " + ";\n ".join(map(lambda x: x["export"] + ((": typeof " + x["export"]) if x["kind"] == "class" else (": " + x["export"] + "_Vals")), typescriptExports)) + ";\n" + \ "};\n\n" + \ "declare function init(): Promise;\n\n" + \ "export default init;\n"