-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Core set of tags for TSDoc #8
Comments
Since The JSDoc supports JSDoc and JavaDoc support Is |
@aciccarello
I think these tags are worth using. |
We eliminated the Widget.render()The See Also
Consider this naive representation: /**
* The `Widget.render()` method draws the widget. See the {@link IRenderable}
* interface for more about rendering. Blah blah blah...
*
* ## See Also
*
* - The {@link IRenderable} interface
* - The {@link http://example.com | Rendering} section of the Widget tutorial
* - (2003). *Widgets: Rendering Them.* Lawrence, KS: University Press of Kansas.
* ISBN 9738-0-706-0899-7.
*/ How would you use the |
The advantage is a standardized way to make the section "see also" and it's up to documentation generator to output it. /**
* The `Widget.render()` method draws the widget. See the {@link IRenderable}
* interface for more information about rendering. Blah blah blah...
*
* @see {@link IRenderable | The interface}
* @see {@link http://example.com | The rendering section of the Widget tutorial}
* @see (2003). *Widgets: Rendering Them.* Lawrence, KS: University Press of Kansas. ISBN 9738-0-706-0899-7.
*/ Usage
The Widget.render() method draws the widget. See the IRenderable interface for more about rendering. Blah blah blah... See also
|
Seems reasonable. However strict mode should enforce that /**
* The `Widget.render()` method draws the widget. @see the {@link IRenderable}
* interface for more about rendering. It has more info about stuff you might like
*
* Blah blah...
*/ |
The Angular application documentation tool Compodoc uses a limited subset of JSDoc tags
That page references the JSDoc support in JavaScript in the TypeScript wiki which I hadn't previously seen. |
The compiler people were planning to follow up with more details about that. I believe they were out of office for various reasons last week. Spring time is busy. :-) |
Please consider: |
Please consider allowing the user to extend the list with their own tags, which in turn could be utilized by third party tools. Couple examples that come to my mind:
|
@BnayaZil all of your listed tags would be redundant, because TypeScript already has both visibility modifiers and @karol-majewski this issue concerns only core set of tags. Additional tags will be supported, but not specified in tsdoc documentation. |
@DovydasNavickas do you mean to async/await as |
@BnayaZil Yes. Do you have something else in mind? |
yes, I thought about callbacks and etc but I see now that JSDoc ask to prevent this kind of use |
Yeah... I'm happy that JSDoc discourages that because having multiple ways to declare asynchronousy makes it harder to use. And |
Many of the things that the compiler supports are more to understand JavaScript code better. Keep in mind they're not necessarily all used for language service support with TypeScript code. So for instance, we show documentation in tooltips using |
P.s.: would be cool to have |
Any thoughts on an |
@EisenbergEffect that seems like a nifty idea, but I am not sure whether it's something that needs to be part of TSDoc vs. say, the publishing pipeline that ingests TSDoc output. @pgonzal thoughts? |
@dend Good point. It would be enough for me if the output of TSDoc simply represented the concept of an associated external file. Then, 3rd party processors could use that information in domain-specific ways. I could do this by convention tool. So, it's not a deal breaker if it doesn't get in. Just tossing scenarios out there. |
@MartynasZilinskas could you give an example of the syntax for |
(I've split off some of the other topics into separate GitHub issues.)
@c69 I think this reflects two different usage scenarios. A large library with commercial support contracts needs something like the AEDoc
I agree that |
@pgonzal Yes, a |
PR #50 introduces definitions for the subset of core tags required by API Extractor. As part of this work, we're separating the tag definitions into four "standardization groups":
Feel free to provide comments/feedback. No aspects of the standard are finalized yet. Right now I'm focused on porting API Extractor to use the TSDoc parser instead of the old custom parser. Based on what we learn from that experience, I'll start trying to lock down various aspects of the specification. |
For a generic type definition, it can be helpful to document what the generic type is used for. Using @template was mentioned in some previous comments but I wonder if VS Code already has some support for /**
* Alias for array
*
* @typeparam T - Type of objects the list contains
*/
type List<T> = Array<T>;
/**
* Wrapper for an HTTP Response
* @typeparam B - Response body
* @param <H> - Headers
*/
interface HttpResponse<B, H> {
body: B;
headers: H;
statusCode: number;
} |
I've split |
I vote for |
Suggested in microsoft/vscode#77261 something like /**
* Take over the specified world.
*
* @param world - The world to dominate.
*
* @remarks
* Optimizes for minimum loss of life, minimum reputation harm, and maximum deviousness.
* Leverages all available capital and human resources without remorse.
*
* @extended
* The development of this procedure began with the Sumerian kings.
* [... long history ...]
*
* @extendedExample
* // Example of error handling based on the latest best practices
* while (!retired) {
* try { takeOverWorld(earth) } catch (error) {
* if (error instanceof InsurrectionError) squashInsurrection()
* else if (error instanceof CoupError) decimateCoup()
* else if (error instanceof GlobalThermonuclearWarError) retire()
* [.. long example list .. ]
* }
* }
*
* @beta
*/
export function takeOverWorld(world: World): void; |
I'm going to close this RFC, since the core set of tags has stabilized. The inventory of tags is more accurately tracked by the file StandardTags.ts. Going forward, if people want to suggest new tags (or modify existing ones), let's open separate issues so they can be discussed individually. |
@bookmoons I created #170 and #171 for the two questions you asked. |
I would love to have something like
That one would be useful. |
TSDoc should define a core set of tags for very common scenarios, so their semantics can be standardized across all tools.
Ignoring the syntax details for a moment, which tags should be included in this list?
Here's some suggestions from AEDoc:
@param
@returns
{@link
}{@inheritdoc}
@remarks
Any others?
The text was updated successfully, but these errors were encountered: