From 3ed363ae39f8850789d7360494adfeb6bfc12552 Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Thu, 29 Mar 2018 17:28:42 +0200 Subject: [PATCH] feat(enum): object.freeze the enum --- crates/cli-support/src/js.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/cli-support/src/js.rs b/crates/cli-support/src/js.rs index e0f7f0f70..239ee2749 100644 --- a/crates/cli-support/src/js.rs +++ b/crates/cli-support/src/js.rs @@ -1573,9 +1573,9 @@ impl<'a, 'b> SubContext<'a, 'b> { enum_string.push_str(&export); enum_string } else { - let mut enum_string = format!("export const {} = {{", enum_.name); + let mut enum_string = format!("export const {} = Object.freeze({{", enum_.name); enum_string.push_str(&variants); - enum_string.push_str("}\n"); + enum_string.push_str("})\n"); enum_string }; self.cx.globals.push_str(&global_export);