如何在打字稿中记录联合类型?

问题描述

如何在打字稿中记录联合类型以便 typedoc 可以提取/显示相关信息?以下是 JSDoc 参考,但是否有 tsdoc 参考?

示例

/**
 * Search parameters
 * These comments are not picked up,I generate blank page
 */
export type SearchParams = string | string[][] | Record<string,string>;

/**
 * Query parameters
 * These comments are not picked up,I generate blank page 
 */
export type QueryParams = SearchParams | Record<string,string | string[]>;

它们只是因为导出而被提取,但没有生成任何信息。 ([email protected],[email protected],[email protected])

编辑:有什么办法可以使用上述工具为这些类型生成文档吗?

解决方法

看起来,DocFx 无法为类型别名和函数生成页面,而只能为类、接口等生成页面……至少在指定版本中。

我已通过检查生成的 *.json 输出文件和生成的 *.yml 文件确认了这一点。所有提到的文件都包含元数据,但 docfx 没有以正确的方式为它们生成 html 页面。

现在我只使用 typedoctypedoc-plugin-markdown 来生成文档,并且它以自己的身份运行良好。