【问题标题】:How to properly document interface properties in compodoc + angular2如何在 compodoc + angular2 中正确记录界面属性
【发布时间】:2019-07-25 17:31:31
【问题描述】:

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

我已经尝试了常见的@property JSDoc 标记,但它不适用于 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;
}

我希望 cmets 仅出现在代码的开头,而不是每个属性的上方,就像旧的 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;
}

我这边的小编辑

在 cmets 上不需要换行,您可以将所有内容放在一行 /** */ 中,如下所示:

/** 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;
}

【问题讨论】:

    标签: angular typescript documentation-generation compodoc


    【解决方案1】:

    目前不支持此功能,但已在 compodoc github 问题中提出feature request

    【讨论】:

    • 似乎是对的,我在那个帖子上添加了一些信息,非常感谢你的洞察力。
    猜你喜欢
    • 1970-01-01
    • 2019-10-09
    • 2021-12-01
    • 2011-03-04
    • 2019-02-07
    • 1970-01-01
    • 1970-01-01
    • 2017-02-25
    • 2018-12-31
    相关资源
    最近更新 更多