-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Improve @overload
's interactions with constructors
#52577
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
Conversation
1. Get `@overload` return type for constructors in getReturnTypeOfSignature 2. No bogus implicit-any error on `new` calls in checkCallExpression 3. No bogus implicit-any error in constructor `@overload`s in getSignaturesOfSymbol
*/ | ||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this test need to be written in such a way as to satisfy #52474?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean putting all the tags into a single comment? No, this test showed that that requirement isn't feasible; the parser can't distinguish between the end of a return-less @overload
and the beginning of the implementation's @param
s. So I reverted it and once again @overload
is unlike all other jsdoc comments in checking all preceding /**
comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, so #52474 is no longer a thing, okay.
!(isJSDocSignature(declaration) && getJSDocRoot(declaration)?.parent?.kind === SyntaxKind.Constructor) && | ||
!isJSDocConstructSignature(declaration) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is isJSDocConstructSignature
supposed to do the check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confusingly, JSDocConstructSignature refers to closure type syntax: function(new: SomeClass)
is equivalent to TS new (): SomeClass
.
The naming scheme could be better though.
@typescript-bot pack this |
Heya @DanielRosenwasser, I've started to run the tarball bundle task on this PR at 57bd245. You can monitor the build here. |
Hey @DanielRosenwasser, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
@overload
return type for constructors in getReturnTypeOfSignaturenew
calls in checkCallExpression@overload
s in getSignaturesOfSymbolFixes #52477 (no bug for (3), which I discovered in the process of fixing (1) and (2))