From cede333f50c63532ff79f1472495a34de0e272e1 Mon Sep 17 00:00:00 2001 From: Katelyn Gadd Date: Sat, 29 Jan 2022 09:09:50 -0800 Subject: [PATCH] Use const enums in typescript since regular enums generate extremely bad code (#64486) To get good behavior in typescript, your enums need to be 'const enum', otherwise it generates some really gross JS with runtime overhead. --- src/mono/wasm/runtime/types.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mono/wasm/runtime/types.ts b/src/mono/wasm/runtime/types.ts index b208aeedcd06a..cc0d1b24583e3 100644 --- a/src/mono/wasm/runtime/types.ts +++ b/src/mono/wasm/runtime/types.ts @@ -195,7 +195,7 @@ export function assert(condition: unknown, messsage: string): asserts condition } // see src/mono/wasm/driver.c MARSHAL_TYPE_xxx and Runtime.cs MarshalType -export enum MarshalType { +export const enum MarshalType { NULL = 0, INT = 1, FP64 = 2, @@ -230,7 +230,7 @@ export enum MarshalType { } // see src/mono/wasm/driver.c MARSHAL_ERROR_xxx and Runtime.cs -export enum MarshalError { +export const enum MarshalError { BUFFER_TOO_SMALL = 512, NULL_CLASS_POINTER = 513, NULL_TYPE_POINTER = 514,