Skip to content
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

Missing description for function-type properties #281

Closed
KillyMXI opened this issue Jan 8, 2022 · 5 comments
Closed

Missing description for function-type properties #281

KillyMXI opened this issue Jan 8, 2022 · 5 comments

Comments

@KillyMXI
Copy link

KillyMXI commented Jan 8, 2022

Minimal type declaration:

export type Foo = {
  /**
   * Bar1
   */
  bar1: () => string,
  /**
   * Bar2
   */
  bar2: (() => string),
  /**
   * Baz
   */
  baz: true | (() => string)
}

Expected markdown:

| Name | Type | Description |
| :------ | :------ | :------ |
| `bar1` | () => `string` | Bar1 |
| `bar2` | () => `string` | Bar2 |
| `baz` | ``true`` \| () => `string` | Baz |

Actual markdown:

| Name | Type | Description |
| :------ | :------ | :------ |
| `bar2` | () => `string` | - |
| `baz` | ``true`` \| () => `string` | Baz |
| `bar1` | () => `string` | - |
  • bar1 moved to the last row. Typedoc considers only this type declaration as a function;
  • bar1 and bar2 both missing their descriptions. This is specific to typedoc-plugin-markdown and is a serious issue.

Typedoc HTML text:

* bar2: () => string
(): string
Bar2

Returns string

* baz: true | (() => string)
Baz

* bar1:function
bar1(): string
Bar1

Returns string
  • not ideal but at least no description is missing.
@KillyMXI
Copy link
Author

KillyMXI commented Jan 9, 2022

Version 3.11.10 half-fixed it:

| Name | Type | Description |
| :------ | :------ | :------ |
| `bar2` | () => `string` | - |
| `baz` | ``true`` \| () => `string` | Baz |
| `bar1` | () => `string` | Bar1 |

@tgreyuk
Copy link
Member

tgreyuk commented Jan 9, 2022

@KillyMXI thanks for feedback. strange because i am seeing the following:

| Name | Type | Description |
| :------ | :------ | :------ |
| `baz` | ``true`` \| () => `string` | Baz |
| `bar1` | () => `string` | Bar1 |
| `bar2` | () => `string` | Bar2 |

Is your code on a public repo by any chance?

@KillyMXI
Copy link
Author

KillyMXI commented Jan 9, 2022

Not public yet. I would've stumbled over this issue before publishing either way.

Typedoc version is 0.22.10. I've also tried 0.22.7 (just chosen randomly), with no observed difference.
Node version is 12.22.6.
Windows 10.

@tgreyuk
Copy link
Member

tgreyuk commented Jan 9, 2022

Ok i worked out why there was a discrepancy - prettier removed surrounding parenthesis from bar2. Please try typedoc-plugin-markdown@3.11.11

@KillyMXI
Copy link
Author

KillyMXI commented Jan 9, 2022

Haha. I don't like prettier for different reasons, but here is an example when something is not an equivalent transformation from different systems point of view.

It should probably be a concern for typedoc. But I think I'm going to make use of it (to have all keys alphabetically sorted) rather than report it :)

I confirm version 3.11.11 is working, produces following result:

| Name | Type | Description |
| :------ | :------ | :------ |
| `bar2` | () => `string` | Bar2 |
| `baz` | ``true`` \| () => `string` | Baz |
| `bar1` | () => `string` | Bar1 |

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants