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

时间:2021-01-28 16:38:21

标签: typescript docfx typedoc

如何在打字稿中记录联合类型以便 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[]>;

它们只是因为导出而被提取,但没有生成任何信息。 (docfx@2.56.6, typedoc@0.19.2, type2docfx@0.10.5)

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

1 个答案:

答案 0 :(得分:0)

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

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

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

相关问题