bjuppa / com-plain-date

JavaScript date-time utilities that keep timezones on the surface
https://deno.land/x/complaindate/mod.ts
MIT License
1 stars 0 forks source link

Docs show "unnamed 0" for destructured function parameters #50

Open bjuppa opened 1 year ago

bjuppa commented 1 year ago

The generated docs have trouble picking up the parameter names when destructuring function parameters. This function declaration:

export function isLeapYear({ year }: SloppyDate): boolean { ... }

...looks like this in docs:

isLeapYear(unnamed 0: SloppyDate): boolean

Searching for }: in the codebase reveals the problematic functions, in 16 files at the time of writing.

bjuppa commented 1 year ago

There seems to be a relation to #51 here... Every destructured argument property in the functions having the "unnamed 0" problem also has it's own "value": "[UNSUPPORTED]" in the output of deno doc mod.ts --json

bjuppa commented 1 year ago

This will show the property name on the line above matches:

deno doc mod.ts --json | grep -B 1 'UNSUPPORTED'

bjuppa commented 1 year ago

55 fixed all the remaining UNSUPPORTED issues that were visible in the generated docs.

The remaining UNSUPPORTED in the docs generated json seems not to surface in the actual generated docs. It may be worth trying to fix UNSUPPORTED in the json to see if that has any effect on the display of the function parameter containing them.

bjuppa commented 1 year ago

Actually, the isLeapYear function doesn't produce UNSUPPORTED in docs json, yet it has an unnamed parameter in the docs.

deno doc utils/isLeapYear.ts --json

bjuppa commented 1 year ago

Update for latest release:

https://deno.land/x/complaindate@v0.7.2/mod.ts?s=isLeapYear

Screenshot 2023-07-07 at 08 14 31

bjuppa commented 1 year ago

Related to this is the question of default values for parameters that are also not currently displayed in docs.

For example https://deno.land/x/complaindate@v0.7.2/mod.ts?s=createUtcInstant where month and day parameters have a default of 1 when not set (the others are 0).

It'd be really helpful to actually see the default values in the docs to understand what happens when you leave out one of the optional parameters.