Allow option of "export const enum" to be ""export enum" in Enums.ts

Issue #96 resolved
Brandon Bell
created an issue

Changing "export enum" to "export const enum" broke my TypeScript code. This is because we actually serialize the enumeration name over the wire (rather than just an unhelpful integer value), so we use non constant enums to translate between the string and numeric values.

For example, if I have an enum such as:

export enum ModuleType { None = 0, Shapes = 1, Maps = 2 }

Then I can do something like this in my TypeScript code:

function convertModuleType(type: ModuleType) { return ModuleType[type]; }

We do this because ModuleType comes as "Shapes" or "Maps" over the wire, not 1 or 2.

Comments (3)

  1. Log in to comment