Skip to content

@typedef is only displayed as three dots #2454

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

Closed
kungfooman opened this issue Dec 5, 2023 · 3 comments
Closed

@typedef is only displayed as three dots #2454

kungfooman opened this issue Dec 5, 2023 · 3 comments
Labels
no bug This is expected behavior

Comments

@kungfooman
Copy link

Search terms

@typedef, three points only, missing documentation for typedef tag

Expected Behavior

I expect that all properties of the given @typedef are listed.

Alternatively a link to a new file explaining this typedef.

Or simply both - make it an option whether a typedef is inlined or creating a new typedef info file.

Actual Behavior

A full @typedef definition is only producing three dots:

image

Steps to reproduce the bug

I use this code:

/**
 * Animal counting object for a zoo.
 *
 * @typedef {object} AnimalCount
 * @property {number} elephant - The number of elephants.
 * @property {number} dolphins - The number of dolphins.
 */

class Location {
    /** @type {AnimalCount} */
    zoo = { elephant: 1, dolphins: 2 };
}

Environment

  • Typedoc version: npm install typedoc@^0.25.4 (same issue on 0.25.1)
  • TypeScript version: ^5.2.2
  • Node.js version: v18.12.1
  • OS: Linux

Full config and repo: https://github.com/playcanvas/engine/blob/main/package.json

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Dec 6, 2023

typedefs will be converted as interfaces -- so long as they are exported.

If I copy your example into a .js file (and export Location), and run TypeDoc on it, I get the following, with a clickable link to AnimalCount

image

JS projects are really annoying to maintain with typedefs since they can't easily re-export types like TS projects can if the entry point doesn't export everything from the sub-module. typedoc-plugin-missing-exports will force typedoc to document that interface even if it isn't exported, but it's better to include it in your entrypoint if possible.

@Gerrit0 Gerrit0 added the no bug This is expected behavior label Dec 6, 2023
@kungfooman
Copy link
Author

Hey @Gerrit0, thank you very much! I tested and your suggested plugin works like a charm!

typedefs will be converted as interfaces -- so long as they are exported.

I'm pretty much new to typedoc, but not new to TypeScript and we discussed this issue back and forth: microsoft/TypeScript#46011

For the time being TypeScript is automatically exporting every @typedef, shouldn't we consider this as swapped order incompatibility between TypeDoc and TypeScript?

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Dec 17, 2023

TypeDoc is respecting TypeScript's behavior here -- while @typedef is implicitly exported, it is not implicitly re-exported if you explicitly name what you're re-exporting from the file in an index.js rollup file.

@Gerrit0 Gerrit0 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 27, 2023
@Gerrit0 Gerrit0 removed the bug label Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no bug This is expected behavior
Projects
None yet
Development

No branches or pull requests

2 participants