-
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
Only pad initializer types for parameters without annotations and contextual signatures #59975
Only pad initializer types for parameters without annotations and contextual signatures #59975
Conversation
@typescript-bot test it |
Hey @jakebailey, the results of running the DT tests are ready. Everything looks the same! |
@jakebailey Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
@jakebailey Here are the results of running the user tests with tsc comparing Everything looks good! |
@jakebailey Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
@typescript-bot test it |
Hey @jakebailey, the results of running the DT tests are ready. Everything looks the same! |
@jakebailey Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
@jakebailey Here are the results of running the user tests with tsc comparing Everything looks good! |
@jakebailey Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
@typescript-bot pack this |
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 |
It's not a revert. Previously object literal types were contextually-typed by their corresponding patterns. So in a situation like this: function test({ a = 1 } = {}) {} The type of this Since the type of the initializer expressions changed in #59183, Anders introduced "object padding" for those initializer types - a way to go from the initializer type to a parameter type using the available binding pattern information. Such mechanism was already used for tuple types. So this was a way to unify the algorithm for both object and array patterns in parameter positions. That new object padding introduced regressions but only because it didn't cover some cases (see #59924 ) and because it's too eager in some other cases (like this one here). TLDR: it's not a revert, it's just an extension of those changes |
fixes #59936