Question: I have enum:

```
export enum Roles {
  user = 10,
  editor = 30,
  admin = 50,
}

```

I import it to one of my services:

```
import { Roles } from '../enums/roles';

```

And use in service method:

```
  this.writeRole(
    Roles.user,
  );

```

And when i call this method in my app, in console i got error: `Cannot read property 'user' of undefined`

But when i simply write the same enum (but without `export` keyword) in service instead of import, its work perfect. Please, explain, what i did wrong and why i can not just import enum like classes?

Answer: 
This error is usually bound to your IDE : let's take for instance Visual studio code (I'm using it and apparently you do too)

When you create a file, VSCode adds it to its index. It allows you to CtrlP to open a file. 

But when you move it, VSCode doesn't rebuild its index. This means it imports your file from a wrong location. 

It will detect it as defined, won't throw any error (because to him, his index is up to date), but at compilation time the issue will pop. 

To avoid that, you can either rebuild the index by reloading VSCode (close it, or hit the command shortcut (F1) and type "reload"), or you can use a plugin such as **[Move Typescript](https://marketplace.visualstudio.com/items?itemName=stringham.move-ts)**, which is very useful for moving files.
In your service / component - just do "enum = Enum":

```
roles = Roles

```