-
Notifications
You must be signed in to change notification settings - Fork 685
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
How to document a type? #278
Comments
I would use and interface for MyType and put JSDoc comments on the properties. Also, have you tried an /** Description of MyType interface */
interface MyType {
/** This property is ... */
haha: number,
/** Optional property useful for ... */
optional?: string
}
/**
* Description of what MyClass is
*/
class MyClass{
/**
* @param config Docs on config property.It is different than the interface docs
*/
constructor(private config: MyType) {
}
} |
Thanks @aciccarello ... Would you please explain me what's the difference between a type and an interface? |
I believe types were introduced later for some specific use cases like type aliases. This SO questions has a good answer describing the differences. Generally I use interfaces for most cases and then use a type if I want an alias, such as getting the type of a specific interface property.
|
Thank you :) @aciccarello |
Anyone know if you can document a type like the original question asks? I have lots of types, and I'm interested in documenting them |
That still doesn't really have an answer. So it should be an issue because there are no docs for type properties. /**
* @property foo Some docs.
*/
type MyFooType = {
/** that comment is ignored */
foo:? string;
} |
@maksnester is this still working for you? I'm trying your workaround and the name is being excluded. |
I've a type used in a class
How to document
MyType
to explain whathaha
andoptional
are used for?The text was updated successfully, but these errors were encountered: