typedoc-plugin-markdown icon indicating copy to clipboard operation
typedoc-plugin-markdown copied to clipboard

Description of deconstructed arguments disappear on inlined callback types

Open arantes555 opened this issue 3 years ago • 0 comments
trafficstars

When generating the documentation for the arguments of a function, any attribute of an argument whose type is an inlined function type loses its description. This does not happen when the argument is directly an argument of the function, or for other types, or when the argument attribute is a function with a named type. (I know the explanation is a bit hard to understand, but hopefully the following example will be much clearer)

TS Code:

export default (
  /** description of directArgFuncWithInlineType */
  directArgFuncWithInlineType: () => void,
  /** description of args */
  args: {
    /** description of argString */
    argString: string,
    /** description of argFuncWithInlineType */
    argFuncWithInlineType: () => void
    /** description of argFuncWithNamedType */
    argFuncWithNamedType: MyCallBack
  }
) => {}

export type MyCallBack = () => void

Generated TS Doc (Notice how the description of args.argFuncWithInlineType is missing.):

...
### default

▸ **default**(`directArgFuncWithInlineType`, `args`): `void`

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `directArgFuncWithInlineType` | () => `void` | description of directArgFuncWithInlineType |
| `args` | `Object` | description of args |
| `args.argFuncWithInlineType` | () => `void` | - |
| `args.argFuncWithNamedType` | [`MyCallBack`](README.md#mycallback) | description of argFuncWithNamedType |
| `args.argString` | `string` | description of argString |

#### Returns

`void`

Expected TS Doc:

...
### default

▸ **default**(`directArgFuncWithInlineType`, `args`): `void`

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `directArgFuncWithInlineType` | () => `void` | description of directArgFuncWithInlineType |
| `args` | `Object` | description of args |
| `args.argFuncWithInlineType` | () => `void` | description of argFuncWithInlineType |
| `args.argFuncWithNamedType` | [`MyCallBack`](README.md#mycallback) | description of argFuncWithNamedType |
| `args.argString` | `string` | description of argString |

#### Returns

`void`

This does seem to be a typedoc-plugin-markdown-specific issue, as on the default typedoc HTML output, the documentations for directArgFuncWithInlineType and args.argFuncWithInlineType seem to be identical.

A repo with a repro case is available at : https://github.com/arantes555/typedoc-testcases

arantes555 avatar Aug 05 '22 12:08 arantes555