-
Notifications
You must be signed in to change notification settings - Fork 719
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
include table of contents & index on type aliases that contain properties #2817
Comments
This would be a super ugly change... those properties are inside the type declaration for the alias, and types never get added to the index... so to implement this, I'd want to move object literal types to regular properties, which is then a significant breaking change. |
Thanks @Gerrit0, makes sense. In reviewing the code, it didn't look trivial to accomplish. It's definitely not a must have, but assuming you agree with the concept, possibly something to consider for next major as, in addition to toc & index, things like |
Yes, that's correct. Those are meant for usage in organizing exports. Attempting to shove so much content into a type that it needs something that is rather insane in my opinion. Split up your types! If object type aliases are reworked to be represented like interfaces, they'd get support for group/interface for free. |
Yeah, agreed, don't see much of a benefit/need for things like I do think there is benefit to a toc & index for types that have props though 😄 |
Search Terms
type alias, table of contents, index
Problem
Type Aliases are often extremely short pages that simply point to the type that is being aliased. However, they can also be actual types with properties or use tags (e.g.,
@useDeclaredType
) in which case properties will be emitted.Currently, on type alias output pages, page navigation can be challenging, especially in situations where there are lots of properties on a type and/or comments & information included. Interfaces contain a table of contents and index section (even when there is only one group with one item in that group) to improve navigation of the page, where type alias pages do not.
Suggested Solution
When a type (likely also applies to variable pages as well) contains properties (either directly, via
@useDeclaredType
, etc.), include a table of contents and index section in the default theme.Below is an interface and a type that are essentially equivalent other than one being an interface and one being a type, yet interface contains the additional navigation elements while type alias does not.
Repro: https://stackblitz.com/edit/vitejs-vite-ek1829mh?file=src%2Findex.ts
Thank you!
The text was updated successfully, but these errors were encountered: