Skip to content

Conversation

Andarist
Copy link
Contributor

@Andarist Andarist commented Jul 20, 2025

fixes #62079

Inferring from an argument with a union type into a distributive conditional type is very likely to produce results that will end up with a signature applicability error. This can be demonstrated by this basic example:

declare class Animal { eat(): void; }
declare class Cat extends Animal { meow(): void; }
declare class Dog extends Animal { bark(): void; }

declare function test1<T>(a: T extends unknown ? { prop: T } : never): T;
declare const arg1: { prop: Dog } | { prop: Cat };

const result1 = test1(arg1); // error
const result2 = test1<Dog | Animal>(arg1); // ok

While there is an easy workaround for the above (one can provide an explicit type argument), it's not possible to do the same in situations involving generic signatures containing distributive conditional types when another conditional type infers from them.

The problem is that infer P (for example, in Parameters) can be instantiated with a union constraint of the input generic signature (so it's capable of "inferring" it) but then that signature is used by instantiateSignatureInContextOf and that can't "synthesize" the union back for the type parameter and ultimately it makes the conditional type (like Parameters) to go for its .falseType branch.

Conceptually, I'm proposing a simple extension to the existing inference algorithm - when the target is a distributive conditional type, the inferred candidates are allowed to be combined into a union. A lower priority inference removes that behavior - but the same priority inference made from a position outside of a distributive conditional type keeps its gathered candidates.

@Copilot Copilot AI review requested due to automatic review settings July 20, 2025 10:52
@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Jul 20, 2025
@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Jul 20, 2025
@typescript-bot
Copy link
Collaborator

Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page.

Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a fix for TypeScript issue #62079 by combining inferences from distributive conditional types. The change modifies the type inference system to properly handle parameters that use distributive conditional types, ensuring that inferences from multiple union member distributions are correctly combined.

  • Adds a new DistributiveConditional inference priority flag to track distributive conditional type inferences
  • Modifies inference priority logic to combine distributive conditional inferences with other priorities
  • Updates the conditional type inference process to mark distributive conditional types with the new priority

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/compiler/types.ts Adds DistributiveConditional inference priority flag and includes it in combination logic
src/compiler/checker.ts Implements distributive conditional inference tracking and priority combination logic
tests/cases/compiler/genericFunctionParametersConditionalType1.ts Test case demonstrating the fix for distributive conditional type parameter inference
tests/baselines/reference/genericFunctionParametersConditionalType1.types Expected type output showing proper union distribution in parameter types
tests/baselines/reference/genericFunctionParametersConditionalType1.symbols Expected symbol resolution output for the test case
Comments suppressed due to low confidence (1)

return;
}
if (inference.priority === undefined || priority < inference.priority) {
const combinedPriority = priority | (inference.individualPriority || InferencePriority.None);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't quite like how this turned out - I probably should move this thing to a separate InferenceInfo property (similar to topLevel) instead of shoving it into .priority.

That said, those changes would be cosmetic and wouldn't really change the idea behind this fix. In the meantime, I'd love to see what user/top tests have to say about this (cc @jakebailey )

@RyanCavanaugh
Copy link
Member

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 21, 2025

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

@typescript-bot
Copy link
Collaborator

Hey @RyanCavanaugh, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

@RyanCavanaugh Here are the results of running the user tests with tsc comparing main and refs/pull/62093/merge:

Something interesting changed - please have a look.

Details

effect

packages/effect/benchmark/tsconfig.json

tsconfig.json

tsconfig.build.json

packages/typeclass/dtslint/tsconfig.json

packages/platform/dtslint/tsconfig.json

packages/effect/dtslint/tsconfig.json

webpack

tsconfig.types.test.json

tsconfig.types.json

tsconfig.json

@typescript-bot
Copy link
Collaborator

@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 193,573k (± 0.76%) 194,753k (± 1.04%) ~ 192,901k 196,743k p=0.575 n=6
Parse Time 1.30s (± 0.64%) 1.30s (± 0.79%) ~ 1.29s 1.31s p=0.923 n=6
Bind Time 0.73s 0.73s ~ ~ ~ p=1.000 n=6
Check Time 9.75s (± 0.40%) 9.74s (± 0.22%) ~ 9.71s 9.77s p=0.260 n=6
Emit Time 2.74s (± 0.78%) 2.75s (± 0.69%) ~ 2.73s 2.78s p=0.511 n=6
Total Time 14.52s (± 0.30%) 14.52s (± 0.13%) ~ 14.50s 14.54s p=0.513 n=6
angular-1 - node (v18.15.0, x64)
Errors 56 56 ~ ~ ~ p=1.000 n=6
Symbols 948,914 948,914 ~ ~ ~ p=1.000 n=6
Types 410,884 410,884 ~ ~ ~ p=1.000 n=6
Memory used 1,226,389k (± 0.00%) 1,226,395k (± 0.01%) ~ 1,226,322k 1,226,495k p=0.936 n=6
Parse Time 6.53s (± 1.02%) 6.52s (± 0.85%) ~ 6.46s 6.62s p=1.000 n=6
Bind Time 1.87s (± 0.44%) 1.87s ~ ~ ~ p=0.290 n=6
Check Time 32.00s (± 0.27%) 31.97s (± 0.31%) ~ 31.88s 32.10s p=0.748 n=6
Emit Time 14.86s (± 0.97%) 14.85s (± 0.59%) ~ 14.74s 14.94s p=0.688 n=6
Total Time 55.26s (± 0.30%) 55.21s (± 0.22%) ~ 55.02s 55.36s p=0.423 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,542,899 2,542,993 +94 (+ 0.00%) ~ ~ p=0.001 n=6
Types 900,428 900,433 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 2,829,362k (± 0.00%) 2,829,402k (± 0.01%) ~ 2,829,202k 2,829,600k p=0.688 n=6
Parse Time 8.76s (± 0.29%) 8.75s (± 0.22%) ~ 8.72s 8.77s p=0.683 n=6
Bind Time 2.26s (± 0.23%) 2.24s (± 0.36%) -0.01s (- 0.59%) 2.23s 2.25s p=0.014 n=6
Check Time 85.74s (± 0.31%) 85.56s (± 0.49%) ~ 84.98s 86.20s p=0.378 n=6
Emit Time 0.59s (±119.68%) 1.01s (±95.34%) ~ 0.30s 2.24s p=0.184 n=6
Total Time 97.35s (± 0.86%) 97.56s (± 0.75%) ~ 96.64s 98.57s p=0.575 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,227,048 1,227,076 +28 (+ 0.00%) ~ ~ p=0.001 n=6
Types 267,470 267,475 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 2,363,435k (± 0.01%) 2,363,612k (± 0.02%) ~ 2,363,060k 2,364,027k p=0.378 n=6
Parse Time 5.21s (± 1.05%) 5.21s (± 1.13%) ~ 5.14s 5.30s p=0.872 n=6
Bind Time 1.80s (± 0.84%) 1.79s (± 1.62%) ~ 1.76s 1.83s p=0.684 n=6
Check Time 35.34s (± 0.46%) 35.43s (± 0.45%) ~ 35.23s 35.68s p=0.298 n=6
Emit Time 2.98s (± 1.32%) 2.97s (± 0.88%) ~ 2.93s 3.00s p=0.630 n=6
Total Time 45.34s (± 0.37%) 45.41s (± 0.40%) ~ 45.21s 45.71s p=0.575 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,227,048 1,227,076 +28 (+ 0.00%) ~ ~ p=0.001 n=6
Types 267,470 267,475 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 3,039,849k (± 9.77%) 3,161,978k (± 0.02%) ~ 3,161,210k 3,162,728k p=0.093 n=6
Parse Time 8.50s (± 1.20%) 8.55s (± 0.46%) ~ 8.51s 8.61s p=0.575 n=6
Bind Time 2.66s (± 1.80%) 2.64s (± 0.95%) ~ 2.61s 2.67s p=0.689 n=6
Check Time 53.22s (± 0.48%) 53.26s (± 0.23%) ~ 53.10s 53.45s p=0.936 n=6
Emit Time 4.46s (± 2.87%) 4.34s (± 2.32%) ~ 4.21s 4.45s p=0.090 n=6
Total Time 68.83s (± 0.48%) 68.79s (± 0.21%) ~ 68.66s 69.05s p=0.936 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 262,548 262,554 +6 (+ 0.00%) ~ ~ p=0.001 n=6
Types 107,156 107,161 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 441,929k (± 0.01%) 441,933k (± 0.01%) ~ 441,855k 442,020k p=0.936 n=6
Parse Time 3.56s (± 0.75%) 3.52s (± 0.61%) -0.04s (- 1.22%) 3.49s 3.55s p=0.024 n=6
Bind Time 1.32s (± 1.07%) 1.32s (± 0.89%) ~ 1.30s 1.33s p=0.934 n=6
Check Time 18.96s (± 0.39%) 18.94s (± 0.46%) ~ 18.86s 19.10s p=0.328 n=6
Emit Time 1.52s (± 0.68%) 1.53s (± 1.36%) ~ 1.49s 1.55s p=0.677 n=6
Total Time 25.36s (± 0.33%) 25.30s (± 0.30%) ~ 25.25s 25.44s p=0.170 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 71 71 ~ ~ ~ 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 371,155k (± 0.03%) 371,137k (± 0.02%) ~ 371,062k 371,229k p=1.000 n=6
Parse Time 2.87s (± 0.72%) 2.89s (± 0.99%) ~ 2.84s 2.92s p=0.257 n=6
Bind Time 1.59s (± 1.45%) 1.61s (± 0.94%) ~ 1.59s 1.63s p=0.243 n=6
Check Time 16.45s (± 0.27%) 16.45s (± 0.38%) ~ 16.36s 16.51s p=0.936 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 20.92s (± 0.30%) 20.95s (± 0.36%) ~ 20.85s 21.02s p=0.423 n=6
vscode - node (v18.15.0, x64)
Errors 1 1 ~ ~ ~ p=1.000 n=6
Symbols 3,524,145 3,524,145 ~ ~ ~ p=1.000 n=6
Types 1,189,792 1,189,792 ~ ~ ~ p=1.000 n=6
Memory used 3,573,696k (± 0.00%) 3,573,744k (± 0.00%) ~ 3,573,612k 3,574,010k p=0.936 n=6
Parse Time 15.09s (± 0.25%) 15.31s (± 3.24%) ~ 15.03s 16.31s p=0.518 n=6
Bind Time 4.89s (± 0.56%) 4.93s (± 0.70%) ~ 4.89s 4.97s p=0.063 n=6
Check Time 101.49s (± 2.87%) 99.85s (± 0.91%) ~ 99.03s 101.54s p=0.298 n=6
Emit Time 31.45s (± 6.16%) 30.51s (± 0.72%) ~ 30.17s 30.82s p=0.575 n=6
Total Time 152.91s (± 1.99%) 150.60s (± 0.79%) ~ 149.19s 152.16s p=0.173 n=6
webpack - node (v18.15.0, x64)
Errors 2 7 🔻+5 (+250.00%) ~ ~ p=0.001 n=6
Symbols 320,541 330,861 +10,320 (+ 3.22%) ~ ~ p=0.001 n=6
Types 140,016 146,362 🔻+6,346 (+ 4.53%) ~ ~ p=0.001 n=6
Memory used 476,527k (± 0.04%) 483,704k (± 0.02%) +7,176k (+ 1.51%) 483,576k 483,847k p=0.005 n=6
Parse Time 4.31s (± 0.54%) 4.30s (± 0.74%) ~ 4.25s 4.35s p=0.935 n=6
Bind Time 1.80s (± 0.97%) 1.79s (± 1.29%) ~ 1.75s 1.82s p=0.567 n=6
Check Time 20.60s (± 0.40%) 20.91s (± 0.45%) +0.31s (+ 1.49%) 20.83s 21.07s p=0.005 n=6
Emit Time 0.00s 0.00s (±154.76%) ~ 0.00s 0.01s p=0.174 n=6
Total Time 26.71s (± 0.33%) 27.00s (± 0.49%) +0.29s (+ 1.08%) 26.85s 27.21s p=0.006 n=6
xstate-main - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 662,663 662,663 ~ ~ ~ p=1.000 n=6
Types 197,635 197,637 +2 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 569,834k (± 0.02%) 569,778k (± 0.02%) ~ 569,601k 569,883k p=0.810 n=6
Parse Time 4.27s (± 0.53%) 4.25s (± 0.51%) ~ 4.22s 4.28s p=0.366 n=6
Bind Time 1.32s (± 0.88%) 1.33s (± 0.88%) ~ 1.31s 1.34s p=0.357 n=6
Check Time 19.96s (± 1.38%) 20.08s (± 1.58%) ~ 19.79s 20.53s p=0.336 n=6
Emit Time 0.00s (±244.70%) 0.00s ~ ~ ~ p=0.405 n=6
Total Time 25.55s (± 1.10%) 25.66s (± 1.32%) ~ 25.33s 26.12s p=0.689 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
Collaborator

@RyanCavanaugh Here are the results of running the top 400 repos with tsc comparing main and refs/pull/62093/merge:

Something interesting changed - please have a look.

Details

TanStack/query

78 of 118 projects failed to build with the old tsc and were ignored

packages/vue-query/tsconfig.prod.json

@jakebailey
Copy link
Member

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 14, 2025

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

Command Status Results
pack this ✅ Started ✅ Results

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 14, 2025

Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/165893/artifacts?artifactName=tgz&fileId=96814B8D1AB03813E1E3411F26BA36E8666C8DE5DD9C65C3DB7356516BE2045002&fileName=/typescript-6.0.0-insiders.20250814.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

@Andarist
Copy link
Contributor Author

@jakebailey could you rerun tests and build a playground for this? :)

@jakebailey
Copy link
Member

@typescript-bot test it
@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 19, 2025

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

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 19, 2025

Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/165913/artifacts?artifactName=tgz&fileId=CEA60AD23CEDEF8C53BBD234DF84C69F7D4FE1DD54417AA138F133466C4B7C3502&fileName=/typescript-6.0.0-insiders.20250819.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

@typescript-bot
Copy link
Collaborator

Hey @jakebailey, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the user tests with tsc comparing main and refs/pull/62093/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Git clone failed"

Otherwise...

Everything looks good!

@typescript-bot
Copy link
Collaborator

@jakebailey
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,803k (± 0.98%) 194,721k (± 1.02%) ~ 192,871k 196,557k p=0.810 n=6
Parse Time 1.30s (± 0.84%) 1.31s ~ ~ ~ p=0.071 n=6
Bind Time 0.73s 0.73s ~ ~ ~ p=1.000 n=6
Check Time 9.75s (± 0.39%) 9.73s (± 0.35%) ~ 9.69s 9.77s p=0.418 n=6
Emit Time 2.74s (± 0.46%) 2.73s (± 0.82%) ~ 2.71s 2.76s p=0.511 n=6
Total Time 14.52s (± 0.23%) 14.50s (± 0.25%) ~ 14.45s 14.53s p=0.808 n=6
angular-1 - node (v18.15.0, x64)
Errors 56 56 ~ ~ ~ p=1.000 n=6
Symbols 948,914 948,914 ~ ~ ~ p=1.000 n=6
Types 410,884 410,884 ~ ~ ~ p=1.000 n=6
Memory used 1,226,424k (± 0.00%) 1,226,399k (± 0.00%) ~ 1,226,369k 1,226,448k p=0.199 n=6
Parse Time 6.48s (± 0.51%) 6.48s (± 0.24%) ~ 6.46s 6.50s p=0.739 n=6
Bind Time 1.87s (± 0.28%) 1.87s (± 0.22%) ~ 1.86s 1.87s p=0.114 n=6
Check Time 32.08s (± 0.25%) 31.97s (± 0.48%) ~ 31.79s 32.16s p=0.297 n=6
Emit Time 14.83s (± 0.30%) 14.76s (± 0.83%) ~ 14.55s 14.87s p=0.378 n=6
Total Time 55.27s (± 0.20%) 55.08s (± 0.42%) ~ 54.69s 55.30s p=0.199 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,545,274 2,545,274 ~ ~ ~ p=1.000 n=6
Types 902,468 902,469 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 2,829,310k (± 0.00%) 2,829,124k (± 0.01%) -186k (- 0.01%) 2,828,891k 2,829,243k p=0.005 n=6
Parse Time 8.73s (± 0.32%) 8.72s (± 0.20%) ~ 8.70s 8.75s p=0.677 n=6
Bind Time 2.23s (± 0.87%) 2.23s (± 0.37%) ~ 2.21s 2.23s p=1.000 n=6
Check Time 86.06s (± 0.38%) 85.93s (± 0.29%) ~ 85.64s 86.31s p=0.575 n=6
Emit Time 0.30s (± 1.35%) 1.00s (±107.80%) ~ 0.30s 2.41s p=0.214 n=6
Total Time 97.32s (± 0.32%) 97.88s (± 1.19%) ~ 96.91s 99.44s p=1.000 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,236,880 1,236,908 +28 (+ 0.00%) ~ ~ p=0.001 n=6
Types 259,623 259,628 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 2,507,480k (±11.82%) 2,629,188k (±14.26%) ~ 2,386,548k 3,113,786k p=0.093 n=6
Parse Time 5.19s (± 1.14%) 5.25s (± 1.46%) ~ 5.16s 5.35s p=0.173 n=6
Bind Time 1.80s (± 1.28%) 1.79s (± 1.04%) ~ 1.77s 1.82s p=0.292 n=6
Check Time 35.10s (± 0.38%) 35.23s (± 0.51%) ~ 35.10s 35.49s p=0.199 n=6
Emit Time 2.99s (± 0.72%) 3.00s (± 0.53%) ~ 2.99s 3.03s p=0.422 n=6
Total Time 45.10s (± 0.34%) 45.27s (± 0.52%) ~ 45.09s 45.59s p=0.128 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,236,880 1,236,908 +28 (+ 0.00%) ~ ~ p=0.001 n=6
Types 259,623 259,628 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 3,060,308k (± 9.66%) 2,697,994k (±13.84%) ~ 2,456,531k 3,181,656k p=0.173 n=6
Parse Time 6.92s (± 0.79%) 6.80s (± 1.77%) ~ 6.67s 7.01s p=0.054 n=6
Bind Time 2.19s (± 2.10%) 2.22s (± 1.20%) ~ 2.17s 2.24s p=0.229 n=6
Check Time 42.63s (± 0.35%) 42.41s (± 0.46%) ~ 42.19s 42.73s p=0.066 n=6
Emit Time 3.55s (± 1.22%) 3.53s (± 2.29%) ~ 3.43s 3.62s p=0.810 n=6
Total Time 55.27s (± 0.36%) 54.96s (± 0.49%) ~ 54.72s 55.39s p=0.066 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 262,407 262,413 +6 (+ 0.00%) ~ ~ p=0.001 n=6
Types 103,907 103,912 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 441,665k (± 0.02%) 441,698k (± 0.01%) ~ 441,622k 441,780k p=0.470 n=6
Parse Time 4.40s (± 0.75%) 4.40s (± 0.56%) ~ 4.37s 4.43s p=0.872 n=6
Bind Time 1.64s (± 1.59%) 1.63s (± 1.44%) ~ 1.60s 1.66s p=0.331 n=6
Check Time 23.46s (± 0.21%) 23.56s (± 0.59%) ~ 23.35s 23.72s p=0.229 n=6
Emit Time 1.91s (± 1.08%) 1.91s (± 1.78%) ~ 1.87s 1.95s p=0.871 n=6
Total Time 31.41s (± 0.21%) 31.48s (± 0.42%) ~ 31.28s 31.61s p=0.297 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 71 71 ~ ~ ~ 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 371,186k (± 0.04%) 371,179k (± 0.03%) ~ 371,047k 371,358k p=0.810 n=6
Parse Time 3.56s (± 1.71%) 3.61s (± 1.04%) ~ 3.55s 3.65s p=0.199 n=6
Bind Time 1.97s (± 1.17%) 1.95s (± 0.75%) ~ 1.93s 1.97s p=0.073 n=6
Check Time 20.40s (± 0.42%) 20.37s (± 0.29%) ~ 20.31s 20.47s p=0.518 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 25.94s (± 0.38%) 25.93s (± 0.24%) ~ 25.87s 26.03s p=0.688 n=6
vscode - node (v18.15.0, x64)
Errors 1 1 ~ ~ ~ p=1.000 n=6
Symbols 3,855,997 3,855,997 ~ ~ ~ p=1.000 n=6
Types 1,215,302 1,215,302 ~ ~ ~ p=1.000 n=6
Memory used 3,686,091k (± 0.01%) 3,686,183k (± 0.01%) ~ 3,685,774k 3,686,340k p=0.471 n=6
Parse Time 19.06s (± 3.02%) 18.86s (± 0.61%) ~ 18.70s 18.99s p=1.000 n=6
Bind Time 6.48s (±13.67%) 6.09s (± 2.02%) ~ 6.00s 6.34s p=0.375 n=6
Check Time 126.17s (± 5.72%) 122.37s (± 1.32%) ~ 120.50s 125.32s p=0.471 n=6
Emit Time 41.39s (±11.49%) 43.21s (±26.18%) ~ 36.77s 65.26s p=0.810 n=6
Total Time 193.09s (± 5.04%) 190.54s (± 5.42%) ~ 184.18s 210.75s p=0.471 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 320,599 320,599 ~ ~ ~ p=1.000 n=6
Types 139,279 139,279 ~ ~ ~ p=1.000 n=6
Memory used 477,261k (± 0.02%) 477,306k (± 0.03%) ~ 477,151k 477,466k p=0.689 n=6
Parse Time 4.30s (± 0.39%) 4.31s (± 0.82%) ~ 4.26s 4.36s p=0.570 n=6
Bind Time 1.86s (± 0.73%) 1.83s (± 1.00%) -0.03s (- 1.70%) 1.80s 1.85s p=0.007 n=6
Check Time 21.12s (± 0.21%) 21.06s (± 0.29%) ~ 21.00s 21.17s p=0.077 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 27.28s (± 0.13%) 27.20s (± 0.30%) -0.08s (- 0.29%) 27.06s 27.30s p=0.037 n=6
xstate-main - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 666,075 666,075 ~ ~ ~ p=1.000 n=6
Types 199,738 199,740 +2 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 572,611k (± 0.03%) 572,550k (± 0.02%) ~ 572,398k 572,671k p=0.298 n=6
Parse Time 4.28s (± 0.59%) 4.27s (± 0.87%) ~ 4.22s 4.32s p=0.871 n=6
Bind Time 1.33s (± 1.02%) 1.33s (± 1.02%) ~ 1.32s 1.36s p=0.669 n=6
Check Time 20.28s (± 2.01%) 20.45s (± 2.06%) ~ 20.00s 20.86s p=0.332 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 25.90s (± 1.50%) 26.05s (± 1.60%) ~ 25.64s 26.47s p=0.261 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
Collaborator

@jakebailey Here are the results of running the top 400 repos with tsc comparing main and refs/pull/62093/merge:

Everything looks good!

@Andarist
Copy link
Contributor Author

I slept on it and figured out a slightly better adjustment to the algorithm than the last fix - the new version has to be tested now.

@jakebailey
Copy link
Member

@typescript-bot test it
@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 20, 2025

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

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 20, 2025

Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/165924/artifacts?artifactName=tgz&fileId=504EAD6FF94ECBC6F82B377C07B66CEC1F5B3D56D020FC5E1F9B1835D5101D0C02&fileName=/typescript-6.0.0-insiders.20250820.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

@typescript-bot
Copy link
Collaborator

Hey @jakebailey, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the user tests with tsc comparing main and refs/pull/62093/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Git clone failed"

Otherwise...

Everything looks good!

@typescript-bot
Copy link
Collaborator

@jakebailey
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 193,516k (± 0.75%) 193,521k (± 0.76%) ~ 192,911k 196,521k p=0.936 n=6
Parse Time 1.31s (± 0.64%) 1.31s (± 0.31%) ~ 1.31s 1.32s p=0.115 n=6
Bind Time 0.73s 0.73s ~ ~ ~ p=1.000 n=6
Check Time 9.73s (± 0.17%) 9.75s (± 0.21%) ~ 9.71s 9.77s p=0.194 n=6
Emit Time 2.75s (± 0.71%) 2.76s (± 0.44%) ~ 2.74s 2.77s p=0.372 n=6
Total Time 14.51s (± 0.18%) 14.54s (± 0.17%) ~ 14.50s 14.57s p=0.124 n=6
angular-1 - node (v18.15.0, x64)
Errors 56 56 ~ ~ ~ p=1.000 n=6
Symbols 948,914 948,914 ~ ~ ~ p=1.000 n=6
Types 410,884 410,884 ~ ~ ~ p=1.000 n=6
Memory used 1,226,389k (± 0.00%) 1,226,384k (± 0.00%) ~ 1,226,326k 1,226,441k p=1.000 n=6
Parse Time 6.52s (± 1.05%) 6.50s (± 0.48%) ~ 6.46s 6.54s p=0.746 n=6
Bind Time 1.87s (± 0.34%) 1.88s (± 0.29%) ~ 1.87s 1.88s p=0.201 n=6
Check Time 32.10s (± 0.26%) 32.00s (± 0.20%) -0.10s (- 0.31%) 31.90s 32.08s p=0.045 n=6
Emit Time 14.77s (± 0.73%) 14.83s (± 0.45%) ~ 14.74s 14.91s p=0.377 n=6
Total Time 55.25s (± 0.18%) 55.21s (± 0.19%) ~ 55.10s 55.39s p=0.689 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,545,275 2,545,369 +94 (+ 0.00%) ~ ~ p=0.001 n=6
Types 902,468 902,473 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 2,829,169k (± 0.01%) 2,829,422k (± 0.00%) +254k (+ 0.01%) 2,829,373k 2,829,491k p=0.005 n=6
Parse Time 8.73s (± 0.24%) 8.73s (± 0.28%) ~ 8.69s 8.75s p=1.000 n=6
Bind Time 2.23s (± 0.28%) 2.23s (± 0.49%) ~ 2.22s 2.25s p=0.787 n=6
Check Time 85.82s (± 0.26%) 86.08s (± 0.38%) ~ 85.44s 86.39s p=0.173 n=6
Emit Time 0.66s (±112.27%) 0.30s (± 1.79%) ~ 0.30s 0.31s p=0.663 n=6
Total Time 97.44s (± 0.89%) 97.34s (± 0.36%) ~ 96.67s 97.68s p=0.810 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,236,880 1,236,908 +28 (+ 0.00%) ~ ~ p=0.001 n=6
Types 259,623 259,628 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 3,116,397k (± 0.03%) 2,995,822k (± 9.88%) ~ 2,390,871k 3,117,500k p=0.810 n=6
Parse Time 8.33s (± 0.53%) 8.28s (± 1.65%) ~ 8.03s 8.41s p=0.936 n=6
Bind Time 2.64s (± 0.68%) 2.65s (± 1.71%) ~ 2.61s 2.74s p=0.873 n=6
Check Time 52.53s (± 0.54%) 52.62s (± 0.46%) ~ 52.14s 52.80s p=0.521 n=6
Emit Time 4.37s (± 1.32%) 4.36s (± 3.14%) ~ 4.22s 4.60s p=0.575 n=6
Total Time 67.86s (± 0.40%) 67.91s (± 0.61%) ~ 67.10s 68.27s p=0.575 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,236,880 1,236,908 +28 (+ 0.00%) ~ ~ p=0.001 n=6
Types 259,623 259,628 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 3,180,440k (± 0.02%) 3,060,187k (± 9.65%) ~ 2,456,470k 3,181,702k p=0.575 n=6
Parse Time 6.92s (± 0.30%) 6.88s (± 1.33%) ~ 6.70s 6.94s p=0.629 n=6
Bind Time 2.17s (± 0.54%) 2.19s (± 1.46%) ~ 2.16s 2.23s p=0.222 n=6
Check Time 42.48s (± 0.20%) 42.66s (± 0.41%) ~ 42.43s 42.84s p=0.093 n=6
Emit Time 3.52s (± 1.92%) 3.55s (± 1.56%) ~ 3.47s 3.61s p=0.471 n=6
Total Time 55.10s (± 0.13%) 55.29s (± 0.51%) ~ 54.83s 55.59s p=0.093 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 262,407 262,413 +6 (+ 0.00%) ~ ~ p=0.001 n=6
Types 103,907 103,912 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 441,570k (± 0.01%) 441,647k (± 0.01%) +76k (+ 0.02%) 441,572k 441,751k p=0.045 n=6
Parse Time 2.92s (± 0.47%) 2.93s (± 0.55%) ~ 2.90s 2.94s p=0.140 n=6
Bind Time 1.11s (± 1.35%) 1.12s (± 1.08%) ~ 1.10s 1.13s p=0.256 n=6
Check Time 15.82s (± 0.39%) 15.88s (± 0.29%) ~ 15.82s 15.94s p=0.146 n=6
Emit Time 1.32s (± 1.05%) 1.31s (± 1.12%) ~ 1.29s 1.32s p=0.460 n=6
Total Time 21.16s (± 0.29%) 21.23s (± 0.25%) ~ 21.17s 21.32s p=0.106 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 71 71 ~ ~ ~ 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 371,163k (± 0.06%) 371,144k (± 0.02%) ~ 371,073k 371,268k p=0.128 n=6
Parse Time 3.58s (± 1.68%) 3.60s (± 0.67%) ~ 3.56s 3.63s p=0.806 n=6
Bind Time 1.98s (± 1.04%) 1.97s (± 0.50%) ~ 1.95s 1.98s p=0.559 n=6
Check Time 20.37s (± 0.31%) 20.39s (± 0.37%) ~ 20.31s 20.48s p=0.573 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 25.92s (± 0.33%) 25.96s (± 0.28%) ~ 25.85s 26.03s p=0.469 n=6
vscode - node (v18.15.0, x64)
Errors 1 1 ~ ~ ~ p=1.000 n=6
Symbols 3,858,457 3,858,457 ~ ~ ~ p=1.000 n=6
Types 1,216,169 1,216,169 ~ ~ ~ p=1.000 n=6
Memory used 3,688,341k (± 0.00%) 3,688,331k (± 0.00%) ~ 3,688,141k 3,688,437k p=0.689 n=6
Parse Time 15.25s (± 0.89%) 15.26s (± 0.62%) ~ 15.15s 15.40s p=0.745 n=6
Bind Time 4.90s (± 0.28%) 4.89s (± 0.65%) ~ 4.84s 4.93s p=1.000 n=6
Check Time 101.50s (± 2.46%) 101.60s (± 2.07%) ~ 99.70s 105.56s p=0.575 n=6
Emit Time 31.43s (± 5.82%) 34.48s (±19.90%) ~ 30.37s 47.36s p=0.873 n=6
Total Time 153.08s (± 2.19%) 156.22s (± 4.69%) ~ 150.25s 169.31s p=0.261 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 320,926 320,954 +28 (+ 0.01%) ~ ~ p=0.001 n=6
Types 139,510 139,529 +19 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 477,765k (± 0.02%) 477,903k (± 0.02%) +139k (+ 0.03%) 477,740k 478,024k p=0.045 n=6
Parse Time 4.36s (± 0.65%) 4.35s (± 0.85%) ~ 4.29s 4.39s p=1.000 n=6
Bind Time 1.86s (± 1.21%) 1.84s (± 0.64%) ~ 1.82s 1.85s p=0.115 n=6
Check Time 21.13s (± 0.45%) 21.19s (± 0.37%) ~ 21.07s 21.26s p=0.336 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 27.35s (± 0.29%) 27.38s (± 0.27%) ~ 27.30s 27.47s p=0.335 n=6
xstate-main - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 666,075 666,075 ~ ~ ~ p=1.000 n=6
Types 199,738 199,740 +2 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 572,436k (± 0.03%) 572,623k (± 0.03%) ~ 572,342k 572,776k p=0.149 n=6
Parse Time 5.30s (± 0.47%) 5.33s (± 0.46%) ~ 5.30s 5.37s p=0.052 n=6
Bind Time 1.65s (± 0.83%) 1.64s (± 0.51%) ~ 1.64s 1.66s p=0.262 n=6
Check Time 25.48s (± 1.66%) 24.98s (± 1.14%) ~ 24.76s 25.54s p=0.065 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 32.43s (± 1.28%) 31.96s (± 0.98%) ~ 31.74s 32.58s p=0.092 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
Collaborator

@jakebailey Here are the results of running the top 400 repos with tsc comparing main and refs/pull/62093/merge:

Everything looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Status: Not started
Development

Successfully merging this pull request may close these issues.

Unable to infer parameters for generic constructor/functions with a distributive conditional type
4 participants