enum Sizes {
  Small = "small",
  Medium = "medium",
  Large = "large"
}

let selected: Sizes = Sizes.Samll;

function updateSize(size: Sizes): void {
    selected = size;
}

updateSize(Sizes.large);

Interesting thing is that you can use enum as Type.

 

 

This is what compile to Javscript:

[TypeScript] String Enums and Inlining Members_[TypeScript]

 

But if you add 'const' to enum:

const enum Sizes {
  Small = "small",
  Medium = "medium",
  Large = "large"

}

[TypeScript] String Enums and Inlining Members_[TypeScript]_02

It compiles to such smaller amount code, with only necessary information