-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Allow discrimination to identical object types when discriminating contextual types #40574
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 discrimination to identical object types when discriminating contextual types #40574
Conversation
Co-authored-by: Orta <[email protected]>
@typescript-bot perf test this |
Heya @weswigham, I've started to run the perf test suite on this PR at aa9eed6. You can monitor the build here. Update: The results are in! |
@weswigham Here they are:Comparison Report - master..40574
System
Hosts
Scenarios
|
what the heck |
I'm not surprised. |
But in this case we're only invoking it when a literal position has possibly discriminating fields, to reduce the types we're discriminating against... which I'd hoped would limit how often it's invoked quite a bit. And yet still the check time nearly tripled, ack. Well, the root cause of the original issue is there being two structurally identical discriminable types in a union - maybe I can tweak the contextual type discrimination rules a bit to allow structurally identical members, instead? |
Definitely think you're better off with that strategy. |
… to unify identical union members
@typescript-bot perf test this |
Heya @weswigham, I've started to run the perf test suite on this PR at a644f6e. You can monitor the build here. Update: The results are in! |
@weswigham Here they are:Comparison Report - master..40574
System
Hosts
Scenarios
|
Much better - perf diffs mostly within the variance measurements. @ahejlsberg @sandersn wanna give this a review? |
Fixes #37231