Typescript type alias for enum

I have this in my typings file:

declare namespace Somatic {
    enum PropType {

In another file index.ts, I have a shorter alias for this enum as:

type PropType = Somatic.PropType;

Then I want to use the aliased enum type in a switch statement:

switch (propType) {
    case PropType.html:

But Typescript does not recognize the aliased enum type values. What is wrong here?


Basically, a definition file is simply declaring the type of existing other code. Enums in TypeScript are actually numbers and more than likely the existing code you’re building on top of doesn’t use actual numbers. A better implementation would probably be to just switch strings;