typedoc
typedoc copied to clipboard
Pretty-print Type Aliases
Search terms
pretty pretty-print type alias type aliases
Expected Behavior
This might just be a setting or something that I'm totally missing. If so, fine to just point me there. I could also see this being 100% intentional behavior. That seems reasonable, given the other information on the page, but if that's the case, I'd like to convert this to a feature request. For almost all of my types, the best way to understand them is to just show the pretty-printed type definition with comments stripped out, then offer the comments further below as you've done already. It would be great for this to be an option.
Given the typescript source:
export type MyType = {
one: string;
two: string;
three: string;
four: string;
names: {
me: string;
you: string;
}
}
The generated docs should show:
T MyType: {
one: string;
two: string;
three: string;
four: string;
names: {
me: string;
you: string;
}
}
Actual Behavior
Given the above Typescript source, the generated docs show the following:
T MyType: { one: string; two: string; three: string; four: string; names: { me: string; you: string } }
Steps to reproduce the bug
- Clone https://github.com/kael-shipman/typedoc-bug
- run
npm install - run
npm run docgen
Environment
- Typedoc version: 0.22.8
- TypeScript version: 4.4.4
- Node.js version: 14.18.1
- OS: Ubuntu Studio Linux 20.04.3
This is expected behavior right now. We don't have custom rendering to try to pretty print any types. It isn't just object types either, https://typedoc.org/api/modules.html#KeyToDeclaration is less than useful... I believe this is something that might be fixed with a theme update that's a work in progress.
Thanks for the explanation! Seems totally reasonable. Feel free to close this or merge it into the theme work.
I'll leave this open until I've confirmed it's resolved :)
captainTorch's output in the PR looks great!
Anyone else know of any work arounds until the PR gets released?
Awesome. Thanks!