Besides, there is an straightforward way to remove enums from a program just like removing type annotations: Inline them as static fields of an object.
There is a simple syntactic transformation.
e.g. change 'enum' to 'const', add a '=' before the '{'
and use ':' instead of '='
const HttpMethod = {
Get: 'GET',
Post: 'POST'
};
// now this no longer breaks
const method = HttpMethod.Post;
Namespaces can be translated in almost the exactly same way.