Only check properties with multiple declarations for never-reduction - #64499
Conversation
|
TypeScript Bot (@typescript-bot) test it |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new pruning behavior lacks regression coverage for reduction edge cases.
Review effort: Balanced
Findings: 1
What changed in this PR
Optimizes intersection reduction by avoiding unnecessary combined-property creation.
Changes:
- Counts property names across intersection constituents.
- Checks only names appearing in multiple constituents for
neverreduction.
| File | Description |
|---|---|
tsc/internal/checker/checker.go |
Adds targeted intersection-property reduction logic. |
| return t | ||
| } | ||
|
|
||
| func (c *Checker) somePropertyReducesToNever(t *Type) bool { |
There was a problem hiding this comment.
There are plenty of tests that already prove the existing reduction behavior.
|
Anders Hejlsberg (@ahejlsberg) Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Anders Hejlsberg (@ahejlsberg) Here are the results of running the user tests with tsc comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
|
Hey Anders Hejlsberg (@ahejlsberg), it looks like the DT test run failed. Please check the log for more details. |
|
Anders Hejlsberg (@ahejlsberg) Here are the results of running the top 400 repos with tsc comparing Everything looks good! |

Inspired by #64476, this PR optimizes
getReducedTypeby checking only properties with declarations in multiple intersection constituents for reduction tonever. The implementation is simpler than #64476 but should have the same effect.Fixes #64474.