0

我已经开始使用 compodoc 来记录我的应用程序,并且在评论记录 openWeather api 接口时我正在努力获得干净的代码。

我已经尝试过常见的@propertyJSDoc 标记,但它不适用于 compodoc,因此要使其按预期工作,我需要编写类似这样的内容

/**
 * Weather information
 */
interface CityWeather {
  /**
   * Weather condition id
   */
  id: number;

  /**
   * Group of weather parameters (Rain, Snow, Extreme etc.)
   */
  main: string;

  /**
   * Weather condition within the group
   */
  description: string;

  /**
   * Weather icon id
   */
  icon: string;
}

我只想在代码的开头而不是在每个属性上方有评论,就像旧的 JSDoc@property {type} [name] 甚至可能有下面这样的东西?或者也许比上面更清洁的方式?

/**
 * Weather information
 *
 * @property id Weather condition id
 * @property main Group of weather parameters (Rain, Snow, Extreme etc.)
 * @property description Weather condition within the group
 * @property icon Weather icon id
 */
interface CityWeather {
  id: number;
  main: string;
  description: string;
  icon: string;
}

我这边的小编辑

评论不需要换行,你可以将所有内容都放在一个单行/** */中,如下所示:

/** Weather information */
export interface CityWeather {
  /** Weather condition id */
  id: number;

  /** Group of weather parameters (Rain, Snow, Extreme etc.) */
  main: string;

  /** Weather condition within the group */
  description: string;

  /** Weather icon id */
  icon: string;
}
4

1 回答 1

1

目前不支持此功能,但已在 compodoc github 问题中提出功能请求。

于 2019-07-25T17:41:10.683 回答