godaddy / godaddy/dmd

Wrong default values

Open
#6 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3
Forks
4
PR merge metrics
No merged PRs in 30d

Description

```javascript
/**
* @callback { object } foo
* Foo description.
*
* @param { string | null } [bar = null]
* Bar description.
*
* @param { string } [baz = '']
* Baz description.
*
* @param { string } [qux = ""]
* Qux description.
*
* @param { string } [quux=]
* Quux description.
*
* @param { string } [quuz = undefined]
* Quuz description.
*/
```

Output with this plugin:

```md
## foo

**Kind**: global typedef

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| \[bar\] | `string` \| `null` | `''` | Bar description. |
| \[baz\] | `string` | `''''` | Baz description. |
| \[qux\] | `string` | `'""'` | Qux description. |
| \[quux=\] | `string` | | Quux description. |
| \[quuz\] | `string` | | Quuz description. |
```

----

## foo

**Kind**: global typedef

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| \[bar\] | `string` \| `null` | `''` | Bar description. |
| \[baz\] | `string` | `''''` | Baz description. |
| \[qux\] | `string` | `'""'` | Qux description. |
| \[quux=\] | `string` | | Quux description. |
| \[quuz\] | `string` | | Quuz description. |

----

Output with default dmd:

```md
## foo : function
**Kind**: global typedef

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [bar] | string \| null | null | Bar description. |
| [baz] | string | "''" | Baz description. |
| [qux] | string | "\"\"" | Qux description. |
| [quux=] | string | | Quux description. |
| [quuz] | string | | Quuz description. |
```

----

## foo : function
**Kind**: global typedef

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [bar] | string \| null | null | Bar description. |
| [baz] | string | "''" | Baz description. |
| [qux] | string | "\"\"" | Qux description. |
| [quux=] | string | | Quux description. |
| [quuz] | string | | Quuz description. |

----

Both are not great. I see no way to document an empty string as the default value.

But the default dmd at least doesn't lie in case of `[bar = null]`.

*(Oh yeah, and it doesn't recognize the callback description after name rather than before name in either case, unlike VSCode, but that's a different story.)*

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.