Skip to content

Use Partial<T> instead of Omit<T, keyof T> when rest spreading - #62573

Closed
Ryan Cavanaugh (RyanCavanaugh) wants to merge 5 commits into
microsoft:mainfrom
RyanCavanaugh:fix62572
Closed

Use Partial<T> instead of Omit<T, keyof T> when rest spreading#62573
Ryan Cavanaugh (RyanCavanaugh) wants to merge 5 commits into
microsoft:mainfrom
RyanCavanaugh:fix62572

Conversation

@RyanCavanaugh

Copy link
Copy Markdown
Member

#62572 seemed like a good idea worth trying

@RyanCavanaugh

Copy link
Copy Markdown
Member Author

Copilot add testcases for this PR

@RyanCavanaugh

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) test it

@typescript-bot

TypeScript Bot (typescript-bot) commented Oct 9, 2025

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
test top400 ✅ Started ✅ Results
user test this ✅ Started ✅ Results
run dt ✅ Started ✅ Results
perf test this faster ✅ Started 👀 Results

Comment thread src/compiler/checker.ts
Comment on lines +11607 to +11615
function isOrContainsKeyofT(keyType: Type, sourceType: Type): boolean {
if (keyType.flags & TypeFlags.Union) {
return !!forEach((keyType as UnionType).types, t => isOrContainsKeyofT(t, sourceType));
}
if (keyType.flags & TypeFlags.Index && (keyType as IndexType).type === sourceType) {
return true;
}
return false;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this traversal could be just a call to someType.

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Ryan Cavanaugh (@RyanCavanaugh), the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Ryan Cavanaugh (@RyanCavanaugh) Here are the results of running the user tests with tsc comparing main and refs/pull/62573/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Git clone failed"

Otherwise...

Everything looks good!

@typescript-bot

Copy link
Copy Markdown
Contributor

Ryan Cavanaugh (@RyanCavanaugh)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - node (v18.15.0, x64)
Errors 34 34 ~ ~ ~ p=1.000 n=6
Symbols 62,370 62,370 ~ ~ ~ p=1.000 n=6
Types 50,386 50,386 ~ ~ ~ p=1.000 n=6
Memory used 194,016k (± 0.94%) 192,781k (± 0.02%) ~ 192,750k 192,819k p=1.000 n=6
Parse Time 1.30s (± 0.64%) 1.30s (± 0.58%) ~ 1.29s 1.31s p=0.172 n=6
Bind Time 0.72s (± 0.71%) 0.72s (± 0.57%) ~ 0.72s 0.73s p=0.595 n=6
Check Time 9.73s (± 0.19%) 9.78s (± 0.31%) +0.04s (+ 0.41%) 9.74s 9.81s p=0.044 n=6
Emit Time 2.75s (± 0.75%) 2.74s (± 0.68%) ~ 2.72s 2.77s p=0.807 n=6
Total Time 14.51s (± 0.13%) 14.54s (± 0.30%) ~ 14.50s 14.61s p=0.255 n=6
angular-1 - node (v18.15.0, x64)
Errors 2 2 ~ ~ ~ p=1.000 n=6
Symbols 955,117 955,117 ~ ~ ~ p=1.000 n=6
Types 415,619 415,619 ~ ~ ~ p=1.000 n=6
Memory used 1,254,556k (± 0.00%) 1,254,562k (± 0.01%) ~ 1,254,473k 1,254,697k p=0.873 n=6
Parse Time 6.53s (± 0.80%) 6.55s (± 0.88%) ~ 6.44s 6.59s p=0.520 n=6
Bind Time 1.88s (± 0.29%) 1.88s (± 0.29%) ~ 1.88s 1.89s p=1.000 n=6
Check Time 32.22s (± 0.32%) 32.22s (± 0.57%) ~ 31.92s 32.45s p=0.810 n=6
Emit Time 14.84s (± 0.39%) 14.87s (± 0.43%) ~ 14.79s 14.94s p=0.630 n=6
Total Time 55.47s (± 0.28%) 55.52s (± 0.35%) ~ 55.28s 55.87s p=1.000 n=6
mui-docs - node (v18.15.0, x64)
Errors 1 1 ~ ~ ~ p=1.000 n=6
Symbols 552,038 552,038 ~ ~ ~ p=1.000 n=6
Types 89 89 ~ ~ ~ p=1.000 n=6
Memory used 826,628k (± 0.00%) 826,629k (± 0.00%) ~ 826,610k 826,666k p=0.748 n=6
Parse Time 8.67s (± 0.64%) 8.67s (± 0.17%) ~ 8.65s 8.69s p=0.746 n=6
Bind Time 2.19s (± 0.41%) 2.19s (± 0.34%) ~ 2.18s 2.20s p=0.798 n=6
Check Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Emit Time 0.28s (± 1.45%) 0.28s (± 3.04%) ~ 0.26s 0.28s p=0.115 n=6
Total Time 11.13s (± 0.51%) 11.14s (± 0.12%) ~ 11.12s 11.16s p=0.466 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,237,230 1,237,239 +9 (+ 0.00%) ~ ~ p=0.001 n=6
Types 259,856 259,861 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 2,486,192k (±11.93%) 2,546,840k (±11.94%) ~ 2,364,228k 3,092,860k p=0.810 n=6
Parse Time 5.17s (± 1.43%) 5.16s (± 1.89%) ~ 5.07s 5.31s p=0.630 n=6
Bind Time 1.77s (± 1.63%) 1.77s (± 0.86%) ~ 1.74s 1.78s p=0.934 n=6
Check Time 35.16s (± 0.56%) 35.09s (± 0.57%) ~ 34.78s 35.30s p=1.000 n=6
Emit Time 2.99s (± 1.06%) 2.98s (± 1.96%) ~ 2.91s 3.07s p=0.630 n=6
Total Time 45.10s (± 0.56%) 45.01s (± 0.52%) ~ 44.79s 45.42s p=0.471 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,237,230 1,237,239 +9 (+ 0.00%) ~ ~ p=0.001 n=6
Types 259,856 259,861 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 3,158,958k (± 0.01%) 3,158,235k (± 0.03%) ~ 3,156,769k 3,159,558k p=0.471 n=6
Parse Time 6.85s (± 0.89%) 6.84s (± 0.27%) ~ 6.81s 6.86s p=0.748 n=6
Bind Time 2.15s (± 2.00%) 2.17s (± 1.42%) ~ 2.14s 2.22s p=0.470 n=6
Check Time 42.72s (± 0.29%) 42.65s (± 0.26%) ~ 42.53s 42.78s p=0.378 n=6
Emit Time 3.52s (± 1.41%) 3.58s (± 3.41%) ~ 3.41s 3.74s p=0.629 n=6
Total Time 55.26s (± 0.22%) 55.24s (± 0.32%) ~ 54.99s 55.46s p=1.000 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 262,534 262,543 +9 (+ 0.00%) ~ ~ p=0.001 n=6
Types 104,035 104,040 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 440,627k (± 0.02%) 440,689k (± 0.01%) ~ 440,659k 440,729k p=0.066 n=6
Parse Time 3.51s (± 0.79%) 3.50s (± 0.96%) ~ 3.45s 3.54s p=0.747 n=6
Bind Time 1.31s (± 1.15%) 1.33s (± 1.43%) ~ 1.31s 1.35s p=0.144 n=6
Check Time 18.97s (± 0.42%) 19.01s (± 0.25%) ~ 18.94s 19.07s p=0.422 n=6
Emit Time 1.53s (± 1.51%) 1.53s (± 0.58%) ~ 1.52s 1.54s p=0.807 n=6
Total Time 25.33s (± 0.27%) 25.36s (± 0.19%) ~ 25.31s 25.43s p=0.296 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 72 72 ~ ~ ~ p=1.000 n=6
Symbols 225,367 225,367 ~ ~ ~ p=1.000 n=6
Types 94,290 94,290 ~ ~ ~ p=1.000 n=6
Memory used 370,282k (± 0.06%) 370,069k (± 0.06%) ~ 369,879k 370,498k p=0.109 n=6
Parse Time 2.82s (± 1.34%) 2.82s (± 1.16%) ~ 2.78s 2.86s p=1.000 n=6
Bind Time 1.61s (± 1.07%) 1.61s (± 1.38%) ~ 1.58s 1.64s p=1.000 n=6
Check Time 16.45s (± 0.42%) 16.42s (± 0.13%) ~ 16.38s 16.44s p=0.517 n=6
Emit Time 0.00s (±244.70%) 0.00s (±244.70%) ~ 0.00s 0.01s p=1.000 n=6
Total Time 20.88s (± 0.34%) 20.85s (± 0.29%) ~ 20.78s 20.92s p=0.629 n=6
vscode - node (v18.15.0, x64)
Errors 6 6 ~ ~ ~ p=1.000 n=6
Symbols 3,916,965 3,916,965 ~ ~ ~ p=1.000 n=6
Types 1,231,412 1,231,412 ~ ~ ~ p=1.000 n=6
Memory used 3,721,578k (± 0.00%) 3,721,722k (± 0.01%) ~ 3,721,070k 3,722,110k p=0.230 n=6
Parse Time 15.23s (± 0.71%) 15.21s (± 0.45%) ~ 15.14s 15.33s p=1.000 n=6
Bind Time 4.95s (± 0.56%) 4.94s (± 0.60%) ~ 4.90s 4.97s p=0.572 n=6
Check Time 101.63s (± 1.23%) 104.58s (± 4.64%) ~ 100.80s 113.52s p=0.378 n=6
Emit Time 38.15s (±18.82%) 37.12s (±16.31%) ~ 30.89s 47.08s p=1.000 n=6
Total Time 159.96s (± 4.45%) 161.84s (± 4.43%) ~ 155.52s 173.35s p=0.689 n=6
webpack - node (v18.15.0, x64)
Errors 40 40 ~ ~ ~ p=1.000 n=6
Symbols 372,609 372,609 ~ ~ ~ p=1.000 n=6
Types 163,185 163,185 ~ ~ ~ p=1.000 n=6
Memory used 529,027k (± 0.02%) 528,971k (± 0.01%) ~ 528,909k 529,052k p=0.575 n=6
Parse Time 4.49s (± 0.46%) 4.51s (± 0.59%) ~ 4.46s 4.53s p=0.052 n=6
Bind Time 1.92s (± 0.83%) 1.93s (± 1.18%) ~ 1.91s 1.97s p=0.565 n=6
Check Time 22.14s (± 0.37%) 22.15s (± 0.24%) ~ 22.07s 22.21s p=0.936 n=6
Emit Time 0.00s (±154.76%) 0.00s ~ ~ ~ p=0.174 n=6
Total Time 28.55s (± 0.28%) 28.60s (± 0.18%) ~ 28.52s 28.66s p=0.374 n=6
xstate-main - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 674,800 674,800 ~ ~ ~ p=1.000 n=6
Types 202,613 202,613 ~ ~ ~ p=1.000 n=6
Memory used 576,885k (± 0.02%) 576,980k (± 0.02%) ~ 576,854k 577,122k p=0.298 n=6
Parse Time 4.17s (± 0.80%) 4.18s (± 0.49%) ~ 4.15s 4.20s p=0.871 n=6
Bind Time 1.34s (± 1.03%) 1.34s (± 1.10%) ~ 1.32s 1.36s p=0.738 n=6
Check Time 20.62s (± 2.18%) 20.52s (± 1.81%) ~ 20.14s 20.87s p=0.689 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 26.13s (± 1.68%) 26.04s (± 1.50%) ~ 25.65s 26.40s p=0.809 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot

Copy link
Copy Markdown
Contributor

Ryan Cavanaugh (@RyanCavanaugh) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/62573/merge:

Everything looks good!

Copilot AI and others added 4 commits October 9, 2025 19:37
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
…revious-commit

Add testcases for Partial<T> rest spreading with keyof T
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Apr 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants