> For the complete documentation index, see [llms.txt](https://petercheng7788.gitbook.io/developer-note/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://petercheng7788.gitbook.io/developer-note/programming-language/typescript/enum.md).

# Enum

```typescript
enum TestType {
  A = "a"
}

export default TestType;
```

```typescript
declare interface Test{
    type: import("../enums/TestType).default
}
```

* Actually, enum is a javascript object

```typescript
enum ChannelType {
  API_KEY ,
  PLAYGROUND,
  TEAMS
}

enum ChannelType2 {
  API_KEY = "api_key" ,
  PLAYGROUND = "playground",
  TEAMS = "teams"
}
console.log(ChannelType, ChannelType2);

/*
Results: 
  // ChannelType
  {
    "0": "API_KEY",
    "1": "PLAYGROUND",
    "2": "TEAMS",
    "API_KEY": 0,
    "PLAYGROUND": 1,
    "TEAMS": 2
  }
   
  // ChannelType2
  {
    "API_KEY": "api_key",
    "PLAYGROUND": "playground",
    "TEAMS": "teams"
  } 
*/


```
