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

defaultValue: "..."? #1552

Closed
kraftwer1 opened this issue Mar 25, 2021 · 2 comments
Closed

defaultValue: "..."? #1552

kraftwer1 opened this issue Mar 25, 2021 · 2 comments
Labels
bug Functionality does not match expectation no bug This is expected behavior

Comments

@kraftwer1
Copy link

kraftwer1 commented Mar 25, 2021

I'm using the JSON feature of TypeDoc.
After upgrading from 0.19.1 to 0.20.33, there are many "..." in the generated JSON.

For example, when running TypeDoc on this code...

/**
 * Test
 */
public data: string[] = []

...I'm getting this:

{
  "name": "data",
  "defaultValue": "...",
  ...
}

Expected Behavior

In 0.19.1, it used to be correct:

{
  "name": "data",
  "defaultValue": "[]",
  ...
}

EDIT

The "defaultValue: "..." also appears in following situations:

public foo: () => void = () => ""
public foo: number = this.bar
// this.bar is another public property of the class (with default of 1).
// TypeDoc 0.19.1 wrote "this.bar" as a hardcoded string, but 1 as number is correct IMHO.

Environment

  • Typedoc version: 0.20.33
  • TypeScript version: 4.0.2
  • Node.js version: 14.11.0
  • OS: macOS Catalina
@kraftwer1 kraftwer1 added the bug Functionality does not match expectation label Mar 25, 2021
@Gerrit0 Gerrit0 added the no bug This is expected behavior label Mar 26, 2021
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 26, 2021

This is expected behavior - TypeDoc will only display initializers if it deems them simple enough to not cause catastrophically bad behavior. See #1288 for an example. Also see #1393 for an example plugin which overrides this behavior for object literals, and can be easily extended for other initializer types.

@kraftwer1
Copy link
Author

Okay... maybe one day an empty array [] or an empty object {} will be simple enough to "not cause catastrophically bad behavior". For now I'll gonna have to explain to my readers what "..." is.

Anyways, I appreciate your outstanding work. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation no bug This is expected behavior
Projects
None yet
Development

No branches or pull requests

2 participants