-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
Modified optional thisArg to capture type #50947
base: main
Are you sure you want to change the base?
Conversation
@microsoft-github-policy-service agree |
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.
@MartinJohns points out that we removed generic this
types earlier because they cost too much for the amount of usage they see. I don't think we should take this change.
@sandersn To be fair, that was five years ago. Things might have changed, making the impact less severe. But I still think this is somewhat of a rare use case. |
The only thing I can think of would be improved caching of generic instantiations, but I don't think much progress has happened there. |
@typescript-bot perf test this |
Heya @sandersn, I've started to run the perf test suite on this PR at a7bab4b. You can monitor the build here. Update: The results are in! |
@sandersn Here they are:
CompilerComparison Report - main..50947
System
Hosts
Scenarios
TSServerComparison Report - main..50947
System
Hosts
Scenarios
StartupComparison Report - main..50947
System
Hosts
Scenarios
Developer Information: |
@typescript-bot test top100 |
Heya @sandersn, I've started to run the regular perf test suite on this PR at 7904d74. You can monitor the build here. Update: The results are in! |
Heya @sandersn, I've started to run the diff-based user code test suite on this PR at 7904d74. You can monitor the build here. Update: The results are in! |
Heya @sandersn, I've started to run the parallelized Definitely Typed test suite on this PR at 7904d74. You can monitor the build here. Update: The results are in! |
Heya @sandersn, I've started to run the diff-based top-repos suite on this PR at 7904d74. You can monitor the build here. Update: The results are in! |
@sandersn 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
|
@sandersn Here they are:
CompilerComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
tsserverComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
StartupComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
Hey @sandersn, it looks like the DT test run failed. Please check the log for more details. |
xstate uses 30% more memory than before, which is consistent with my concerns. Also, user tests show failures in calls to functions that have some type arguments already, meaning that the new type parameters need defaults to avoid this. However, I don't think it's worthwhile to make that change given the slowdown in xstate. |
This change makes most method accepting a
thisArg
parameter generic, thus enabling them to capture the type of the parameter and properly recognising it in the callback function.This makes it possible to write the wordy
as
Fixes #51020