-
Notifications
You must be signed in to change notification settings - Fork 65
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
Question: how do I document a object property "interface" in pure JSDoc? #124
Comments
Maybe it's a different issue but here's what I tried: Example 1: /**
* @prop {MyType} foo - foo header docs
*/
export class TestComponent extends LitElement {
static get properties () {
return {
foo: { type: Object, attribute: false },
};
}
} Output 1: {
"version": 2,
"tags": [
{
"name": "test-component",
"jsDoc": "/**\n * @prop {MyType} foo - foo header docs\n */",
"properties": [
{
"name": "foo",
"type": "{}"
}
]
}
]
} The documentation is missing and the type is Example 2: /**
* @prop {MyType} foo - foo header docs
*/
export class TestComponent extends LitElement {
static get properties () {
return {
/** @type {MyType} */
foo: { type: Object, attribute: false },
};
}
} The documentation is missing and the type is Example 3: /**
* @prop {MyType} foo - foo header docs
*/
export class TestComponent extends LitElement {
static get properties () {
return {
/** foo line above docs */
foo: { type: Object, attribute: false },
};
}
} Output 3: {
"version": 2,
"tags": [
{
"name": "test-component",
"jsDoc": "/**\n * @prop {MyType} foo - foo header docs\n */",
"properties": [
{
"name": "foo",
"description": "foo line above docs",
"jsDoc": "/** foo line above docs */",
"type": "{}"
}
]
}
]
} Document is picked up from line above JSDoc. |
Looking at https://github.com/runem/web-component-analyzer/blob/master/src/analyze/util/js-doc-util.ts#L83 I guess I understand why I cannot (yet) do what I want. |
Thanks for opening this issue :-) I see two issues in what you are mentioning: (1) incorrect merging of members and (2) problems with parsing JSDoc type expressions.
|
I'm available to review any local branch or something if it can help. |
I'll be committing my work to the refactor branch very soon. At the same time I'll create an issue that describes the changes to the member-merging logic with examples. It would be great to have your feedback on that! :-) I'll remember to tag you when I create the issue 👍 |
I created the issue here #125 :-) |
Version |
Hey ;-)
I would really like to document all my LitElement components without using any TypeScript. I was wondering how I could document the type of an object property?
Let's consider this example:
A scan gives me this:
I would like wca to output
"type": "MyType"
and also expose the definition ofMyType
so it could end up in the documentation.I tried many combinations with
@type
,@prop
and@typedef
in the JSDoc on top of the class and on top of thefoo: { ...}
but nothing really successful."type": "MyType"
?MyType
?The text was updated successfully, but these errors were encountered: