简体   繁体   中英

How to document union types in typescript?

How to document Union type in typescript so typedoc can pull/show relevant info? This below is a JSDoc reference but is there one for TSDoc?

Example

/**
 * 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[]>;

They are just picked up because of export but no info whatsoever was generated. ( docfx@2.56.6 , typedoc@0.19.2 , type2docfx@0.10.5 )

EDIT: Is there any way I can generate docs for these types using the tools above?

It appears that it doesn't matter what comments we put there the DocFx is unable to generate pages for type aliases and functions but only for classes, interfaces, etc... at least at the specified version.

I have confirmed this by inspecting the generated *.json output file and the resulting *.yml files. All mentioned files include the metadata but the docfx doesn't generate the html pages for them the right way.

Now I'm using only typedoc with typedoc-plugin-markdown to generate docs and its working fine in its own capacity.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM