Skip to content
Permalink
Browse files
fix: es6 export enum (#1446)
Co-authored-by: Alexander Fenster <fenster@google.com>
  • Loading branch information
sapphi-red and alexander-fenster committed Jul 17, 2020
1 parent f9f2c43 commit 9f33784350b1efc2e774bbfc087cbd2c47828748
Showing with 4 additions and 1 deletion.
  1. +4 −1 cli/targets/static.js
@@ -682,7 +682,10 @@ function buildEnum(ref, enm) {
comment.push((config.forceEnumString ? "@property {string} " : "@property {number} ") + key + "=" + val + " " + (enm.comments[key] || key + " value"));
});
pushComment(comment);
push(escapeName(ref) + "." + escapeName(enm.name) + " = (function() {");
if (!ref && config.es6)
push("export const " + escapeName(enm.name) + " = " + escapeName(ref) + "." + escapeName(enm.name) + " = (() => {");
else
push(escapeName(ref) + "." + escapeName(enm.name) + " = (function() {");
++indent;
push((config.es6 ? "const" : "var") + " valuesById = {}, values = Object.create(valuesById);");
var aliased = [];

0 comments on commit 9f33784

Please sign in to comment.