-
Notifications
You must be signed in to change notification settings - Fork 708
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
Methods returning this
are documented as returning the class
#2458
Comments
This is intentional-ish. TypeDoc asks the type checker for what type is in use on the class when doing documentation to handle generic parameters which should be resolved at that point (
|
Well, my goal here is less "type" and more "doc". As in, what's the best way to indicate in the docs that methods are intended for chaining of the same instance, when some methods do return a different instance? (Preferably without typing out a sentence to that effect in each doc comment. 😉) |
I think it would be an improvement for TypeDoc to document these methods as returning |
Looking at this again, I see why I didn't do it for implicit |
Thanks! |
Search terms
Methods with "return this" are documented as returning the class; method chaining.
Question
I have just started using typedoc on a project and am noticing that the output is imprecise regarding methods that return
this
. In VSCode's hints, these methods are identified as such, but typedoc lists them as returning an arbitrary instance of the class. This makes it challenging to tell from the documentation which methods are returning the same instance rather than a new one. (As I have a class with both kinds of methods.)(It does this even if I explicitly declare the method as returning this - i.e.
someMethod(): this {...}
, let alone implicitly.)Is this intentional, an oversight, or something else? Is there any way to force the output to show
this
for such methods? Thanks.The text was updated successfully, but these errors were encountered: