-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Allow nested reverse mapped type printback #42485
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
Allow nested reverse mapped type printback #42485
Conversation
@typescript-bot perf test this |
Heya @weswigham, I've started to run the parallelized Definitely Typed test suite on this PR at 84241ef. You can monitor the build here. |
Heya @weswigham, I've started to run the perf test suite on this PR at 84241ef. You can monitor the build here. Update: The results are in! |
Heya @weswigham, I've started to run the extended test suite on this PR at 84241ef. You can monitor the build here. |
Heya @weswigham, I've started to run the parallelized community code test suite on this PR at 84241ef. You can monitor the build here. |
@weswigham Here they are:Comparison Report - master..42485
System
Hosts
Scenarios
|
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
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.
- I like the behaviour change,
- agree with the index access simplification
- have a question about the nested printback
- don't feel qualified to OK the caching change (perf tests help here although I don't think we test mapped types at all on them)
When the reverse mapped type in question both isn't already being printed, and isn't the child type of a reverse mapping over a non-anonymous type (eg,
Window
orNumber
). This means that reverse mappings over object literal expression types should be printed back in full, rather than getting truncated.To support this change, I've added caching into reverse mapped symbol type lookup (previously we'd redo the inference every time we asked for the type of the symbol), and introduced a simplification into the construction of reverse mapped symbols so we manufacture less type identities when doing deep reverse mappings (by recognizing that
{[K in keyof T[K_1]]: Whatever<T[K_1]>]}
is equivalent to{[K in keyof T]: Whatever<T>]}
as far as reverse mapped symbol type inference is concerned). Without that, we'd manufacture new sets of type identities for every type mapped over for every level "down" we had to recur within a deeply-reverse mapped type.Fixes #40003 in most cases.