denoland / deno_std

The Deno Standard Library
https://jsr.io/@std
MIT License
2.83k stars 582 forks source link

to-do: fix unsupported symbols #5316

Open iuioiua opened 2 days ago

iuioiua commented 2 days ago

Background

deno doc doesn't seem to some symbols as a default arguments or @default JSDoc tag values. While this is a runtime issue, we should fix this on our side in the meantime of that being fixed. These symbols come up as [UNSUPPORTED] in documentation, preventing them from being fully understood.

Fix instructions

To fix, remove the default value of an argument, and make that argument optional, if that default value is an object. Then, set the default value within the function body. There are probably other cases that should be considered, but this is likely the main case.

- function foo(arg1: MyInterface = {}) {
+ function foo(arg?: MyInterface) {
+   arg ??= {};

  // ...

  }

The fix can be confirmed by running deno doc --html <script>, then searching for [UNSUPPORTED] within the output in /docs.

Affected APIs

These symbols seem to be affected:

kt3k commented 2 days ago

I think we should fix this in deno_doc. There seem too many places to fix.

cc @crowlKats

crowlKats commented 2 days ago

I think we should fix this in deno_doc. There seem too many places to fix.

cc @crowlKats

Yep I agree, this should be fixed upstream rather than circumventing the issue