how to generate doc for typescript enum type {[key]: value }?

570 views Asked by At

I am writing a logger service for nodeJS in Typescript. I have an enum as below:

enum LOG_TYPES {
  NONE = 0,
  ERROR = 1,
  WARN = 2,
  INFO = 3,
  DEBUG = 4,
}

then I have an setLogType function:

setLogType(type: LOG_TYPES) {
 this.logType = type
}

My problem is I don't know how to make docs for the type param.

current behaviour

My expectation is the recommendation would show like this

0                   NONE
1                   ERROR
2                   WARN
3                   INFO
4                   DEBUG
...
1

There are 1 answers

0
Mor Bargig On
enum LOG_TYPES {
  NONE = 0,
  ERROR = 1,
  WARN = 2,
  INFO = 3,
  DEBUG = 4,
}
setLogType(type: keyof typeof LOG_TYPES) {
 this.logType = type
}