【发布时间】: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