-
Notifications
You must be signed in to change notification settings - Fork 710
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
Nested parameter not rendered when top parameter is optional #1020
Comments
That makes a lot of sense why nested keys aren't rendered when an argument is optional. I definitely think it makes sense to render nested keys when an argument is marked as optional with |
@Gerrit0 Is it even possible to discriminate between
|
Purely from the JSON output, I guess it isn't possible. This seems like an oversight to me. |
You are right indeed, did not think about this, they are not the same in this optic. It's really a blocker for me and I would like to make the fix. For now, I've skim between converter code and default theme doing the final rendering, still looking for the place where an object parameter is being converted to nested field, I guess there might be a recursive call somewhere. Do you have some hints where I should look for in my hunt for a fix? |
I'm not very familiar with how the theme works, it's been on my list to read through for a while. Parameters are rendered here. |
Any updates? Any fixes? |
I suspect #1103 may fix this, but I haven't had the time to dig into it yet. |
Yeah, It works now. |
TypeDoc doesn't know what to do with this ^ You don't have any parameters called
|
But |
Yes, but since you destructed the parameters so that it is available as |
That's unfortunate :/ I thought the changes to exports would have fixed that. |
Fixed in [email protected]. If you install without a lockfile it should be picked up, or v0.16.3 (out later today) will pull this in. Turns out the information to render everything was already there (partially due to the changes done to exports), but the themes weren't updated to support it. If you are using a custom theme that has changed the Rendering is tricky. There are cases when dealing with unions/intersections, conditional types, and function types where you have to be very careful to avoid generating an invalid type. I think I've caught all the edge cases, but it's possible I missed one. |
Thank you @Gerrit0 for addressing this issue. For the same example above now it renders as: Since foobar is documented, shouldn't "Type declaration" be rendered below? Who looks at the documentation knows that bar can be an object with a foobar property, but doesn't know what it is about. This happens with nested properties too, for example:
Render as: So baz isn't documented. |
That could certainly use some improvement, feel free to open a new issue :) I really want to completely rebuild the default theme. I think there is some major room for improvement in rendering the types in an easily understandable way, the nested lists used right now work, but get unwieldy... Unfortunately I don't think I'll get to this for a while... |
Expected Behavior
This snippet should render the nested parameter
value
correctly in the HTML output:More Information
The bug is caused because in strict mode, this snippet get's rendered as an union type of the form
{ ... } | undefined
. It seems typedoc will not render the nested parameters in this case.This test case fails also even when
strict: false
:Would you accept a PR that cover this cases (I would extend it to null/both cases also
... | null, ... | undefined, ... | null | undefined
).Actual Behavior
The nested parameter should be rendered.
Steps to reproduce the bug
See https://github.com/maoueh/typedoc-bug-1020-repro
strict: true
(this generates a union type from the parser point of view)Environment
The text was updated successfully, but these errors were encountered: