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

property emits object for its type instead of inlined typed #733

Closed
techfg opened this issue Dec 8, 2024 · 3 comments
Closed

property emits object for its type instead of inlined typed #733

techfg opened this issue Dec 8, 2024 · 3 comments
Labels
bug Issue raised as a bug. fixed Fix implemented in latest version.

Comments

@techfg
Copy link

techfg commented Dec 8, 2024

What package is the bug related to?

typedoc-plugin-markdown

Describe the issue

The generated markdown contains object instead of the inlined type for properties of a type whose type is based on a typedef.

Repro: https://stackblitz.com/edit/vitejs-vite-xwhbv4ro

Steps to reproduce

  1. Open repro
  2. npm run docs:md
  3. View docs-md/interfaces/Foo.md

Actual Result

  • Markdown
    image
  • HTML
    image

Additional Information

  1. The issue does not occur when generating html files (npm run docs:html)
  2. I attempted to isolate the issue without using zod, however I was unsuccessful despite several different ways of trying to achieve. It does not appear to be a zod problem since the html version emits as expected but apologies for not being able to narrow this down any further.
  3. This seems similar to the object problem in Unioned type for function param emits object instead of inline type for type that is based on a typedef #720

TypeDoc configuration

typedoc: 0.27.3
typedoc-plugin-markdown: 4.3.1
typescript: 5.7.2

Expected behavior

The types for Foo.c and Foo.d should be inlined.

@techfg techfg added the bug Issue raised as a bug. label Dec 8, 2024
@tgreyuk
Copy link
Member

tgreyuk commented Dec 8, 2024

Thank you.

Full inoine object is now represented inside type arguments (as per prop C). typedoc-plugin-markdown@4.3.2.

Please note that where associated docs are included (as per prop D) then by default the keyword object is set by default as otherwise it can create quite a lot of noise for large inline objects. However expandObjects=true can be set to always display inline object type regardless if associated docs are included or not.

Hope that makes sense? This is perhaps not very obvious, so will review at some point, but hopefully this behaviour is acceptable for time being.

@tgreyuk tgreyuk added the fixed Fix implemented in latest version. label Dec 8, 2024
@techfg
Copy link
Author

techfg commented Dec 8, 2024

Thanks for the quick fix @tgreyuk, greatly appreciated!

Understood and makes sense on the decision to use object when associated docs are included. As you mention, expandObjects does provide ability to expand when needed, only drawback is that it's a global config vs. a type specific config.

Something to consider for future possibly is that I do think there is something to be said for having the default generated output as closely align with the default typedoc output (html format) except for in areas where it does not make any sense for markdown.

All that said, as of v4.3.2 this is working by design now, thank you again!

@tgreyuk
Copy link
Member

tgreyuk commented Dec 8, 2024

I will close this as fixed, but as noted will continue work with aligning with html theme when it makes sense to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue raised as a bug. fixed Fix implemented in latest version.
Projects
None yet
Development

No branches or pull requests

2 participants