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

How to document union types in typescript?

如何在打字稿中记录 Union 类型,以便 typedoc 可以 pull/show 相关信息?下面是一份 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)

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

看来无论我们在此处放置什么注释都无关紧要,DocFx 无法为类型别名和函数生成页面,而只能为 类、接口等生成页面......至少在指定的版本。

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

现在我只使用 typedoctypedoc-plugin-markdown 来生成文档,并且它在自己的能力下工作正常。