-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Fixed issue with method called new
being emitted as construct signature
#55109
Conversation
0e8e53d
to
3286ba0
Compare
@@ -32,8 +32,8 @@ var a: { new(x: Date): string } | |||
>x : Date | |||
|
|||
var b = { new(x: RegExp) { return ''; } }; // not a construct signature, function called new | |||
>b : { new(x: RegExp): string; } | |||
>{ new(x: RegExp) { return ''; } } : { new(x: RegExp): string; } | |||
>b : { "new"(x: RegExp): string; } |
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.
This doesn't seem right... aren't all of these cases changed explicitly construct signatures that shouldn't be quoted?
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.
This one definitely isnt wrong. Notice how this is inferred~ from an object literal and that cant even have a construct signature - it’s just a method called new
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.
Agh, yeah. I think I skimmed this PR on my phone on the weekend and had it in my head that there was something going on.
@typescript-bot test this |
Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at 3825f0e. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the diff-based top-repos suite on this PR at 3825f0e. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at 3825f0e. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the extended test suite on this PR at 3825f0e. You can monitor the build here. |
@jakebailey Here are the results of running the user test suite comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Something interesting changed - please have a look. Details
|
@jakebailey Here are the results of running the top-repos suite comparing Everything looks good! |
Hey @jakebailey, the results of running the DT tests are ready. |
@typescript-bot pack this |
Heya @jakebailey, I've started to run the tarball bundle task on this PR at 3825f0e. You can monitor the build here. |
Hey @jakebailey, 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 |
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.
LGTM, though maybe @rbuckton may have some other trick that would be preferred over this particular fix.
Actually, maybe this is a silly question, but should this be a declaration emit fix? I assume not, given the types baselines and tooltips are also wrong? |
@jakebailey could you rephrase? from what I can tell both types baselines and tooltips are changed (and fixed) by this change |
My question was "should this fix be in declaration emit", but I half convinced myself the answer was "no" because of tooltips and baselines. Of course, the fix could be applied to both |
On second thought, this doesn't feel right; I think I found a better fix via Would you rather I send a new PR for this or push to your branch? (I am keeping the credit for the tests, of course; I just cloned this PR and then swapped the fix.) |
I don't want to stomp on your branch, I'll send a different PR. |
See: #55750 |
fixes #55075