简体   繁体   中英

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

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.

当前行为

My expectation is the recommendation would show like this

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM