-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Description
continuing conversation from #1124 (comment)
There are two approaches to add JSDoc descriptions for TypeScript function parameters.
-
In the parameter type definition's JSDoc block. Example:
nextstrain.org/static-site/app/blog/parseMarkdown.ts
Lines 6 to 18 in 2998b80
export default async function parseMarkdown({ mdString, addHeadingAnchors = false, headingAnchorClass = undefined, }: { mdString: string /** Should `<a>` tags be added to headings? */ addHeadingAnchors?: boolean /** Class name for heading anchors (from page-specific CSS Module) */ headingAnchorClass?: string }): Promise<string> { Benefits:
- Description appears on hover of the parameter
- Keeps the variable name, type, and description all in one place with no duplication
-
In the function's JSDoc block using
@param. Example:nextstrain.org/static-site/components/list-resources/index.tsx
Lines 131 to 138 in 2998b80
* @param versioned - boolean for whether the resources are versioned * @param elWidth - width of the element * @param quickLinks - list of `QuickLink` objects for the resources * @param defaultGroupLinks - boolean for if the group name is a url * @param groupDisplayNames - apping from group name -> display name * @param tileData - the tiles for the resources */ function ListResourcesContent({ Benefits:
- Description appears on hover of the function
Tasks
- Settle on a single approach as the standard
- Replace existing usage of the other approach
- Document this standard (maybe as part of Standardize TypeScript usage auspice#1890, which should apply not just to Auspice but all TypeScript usage under @nextstrain)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels