Skip to content

Conversation

@Andarist
Copy link
Contributor

@Andarist Andarist commented Jun 18, 2024

fixes #50719
fixes #41461
fixes #57905

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Jun 18, 2024
@Andarist Andarist force-pushed the fix/filter-out-return-type-inference-by-constraint-applicability branch from 34d5fbe to b9936e3 Compare June 18, 2024 08:05
}
else {
if (inference.priority! & InferencePriority.ReturnType) {
inference.inferredType = filterContextualInferredType(inferredType, instantiatedConstraint) ?? (fallbackType && filterContextualInferredType(fallbackType, instantiatedConstraint)) ?? instantiatedConstraint;
Copy link
Member

Choose a reason for hiding this comment

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

We only need to bother with this filtering if the constraint check for the whole union fails, right? (Since if it passes, no filtering will occur, as every union member must also pass.) This can probably be inside the comparison branch below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That’s right but it felt cleaner to have this in a separate branch. Shouldnt filterType already optimize for array/type allocations?

@Andarist Andarist requested a review from weswigham June 19, 2024 10:17
@jakebailey
Copy link
Member

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 19, 2024

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 @jakebailey, the results of running the DT tests are ready.

There were interesting changes:

Branch only errors:

Package: jest
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/jest/jest-tests.ts
  762:1  error  TypeScript@local compile error: 
Type 'SpyInstance<void, [number | void], any>' is not assignable to type 'SpiedSetter<number>'.
  Types of property 'mock' are incompatible.
    Type 'MockContext<void, [number | void], any>' is not assignable to type 'MockContext<void, [number], any>'.
      Type '[number | void]' is not assignable to type '[number]'  @definitelytyped/expect

✖ 1 problem (1 error, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.21_typescript@5.6.0-dev.20240619/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.21_typescript@5.6.0-dev.20240619/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

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/58910/merge:

Something interesting changed - please have a look.

Details

webpack

tsconfig.types.json

@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 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,153 62,153 ~ ~ ~ p=1.000 n=6
Types 50,242 50,243 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 193,782k (± 0.94%) 192,726k (± 0.75%) ~ 192,087k 195,687k p=0.471 n=6
Parse Time 1.30s (± 0.93%) 1.29s (± 2.10%) ~ 1.25s 1.31s p=0.422 n=6
Bind Time 0.71s 0.71s ~ ~ ~ p=1.000 n=6
Check Time 9.40s (± 0.44%) 9.43s (± 0.28%) ~ 9.40s 9.46s p=0.258 n=6
Emit Time 2.74s (± 0.74%) 2.76s (± 0.50%) ~ 2.74s 2.78s p=0.105 n=6
Total Time 14.16s (± 0.17%) 14.19s (± 0.31%) ~ 14.12s 14.24s p=0.148 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 944,114 944,138 +24 (+ 0.00%) ~ ~ p=0.001 n=6
Types 407,051 407,082 +31 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 1,218,315k (± 0.00%) 1,218,358k (± 0.00%) ~ 1,218,299k 1,218,401k p=0.092 n=6
Parse Time 6.64s (± 0.57%) 6.68s (± 0.79%) ~ 6.64s 6.78s p=0.086 n=6
Bind Time 1.88s (± 1.38%) 1.87s (± 1.17%) ~ 1.85s 1.91s p=0.618 n=6
Check Time 30.59s (± 0.26%) 30.68s (± 0.42%) ~ 30.50s 30.88s p=0.199 n=6
Emit Time 13.56s (± 0.36%) 13.55s (± 0.27%) ~ 13.48s 13.58s p=0.627 n=6
Total Time 52.67s (± 0.15%) 52.78s (± 0.24%) ~ 52.59s 52.95s p=0.149 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 4 🔻+4 (+ ∞%) ~ ~ p=0.001 n=6
Symbols 2,133,420 2,131,417 -2,003 (- 0.09%) ~ ~ p=0.001 n=6
Types 926,456 925,839 -617 (- 0.07%) ~ ~ p=0.001 n=6
Memory used 2,115,464k (± 0.00%) 2,114,668k (± 0.00%) -796k (- 0.04%) 2,114,572k 2,114,839k p=0.005 n=6
Parse Time 6.60s (± 0.17%) 6.60s (± 0.25%) ~ 6.58s 6.62s p=0.566 n=6
Bind Time 2.33s (± 0.22%) 2.34s (± 0.96%) ~ 2.30s 2.37s p=0.437 n=6
Check Time 70.66s (± 0.48%) 70.45s (± 1.32%) ~ 68.63s 71.17s p=0.873 n=6
Emit Time 0.14s (± 3.77%) 0.13s (± 3.87%) ~ 0.13s 0.14s p=0.311 n=6
Total Time 79.73s (± 0.42%) 79.52s (± 1.15%) ~ 77.73s 80.25s p=0.873 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,230,762 1,230,884 +122 (+ 0.01%) ~ ~ p=0.001 n=6
Types 261,187 261,272 +85 (+ 0.03%) ~ ~ p=0.001 n=6
Memory used 2,345,612k (± 0.04%) 2,346,043k (± 0.04%) ~ 2,345,013k 2,347,238k p=0.575 n=6
Parse Time 4.99s (± 1.28%) 5.00s (± 0.95%) ~ 4.93s 5.06s p=0.748 n=6
Bind Time 1.90s (± 0.87%) 1.90s (± 0.70%) ~ 1.89s 1.92s p=0.616 n=6
Check Time 33.74s (± 0.26%) 33.80s (± 0.18%) ~ 33.71s 33.86s p=0.170 n=6
Emit Time 2.71s (± 2.78%) 2.69s (± 2.56%) ~ 2.61s 2.81s p=0.298 n=6
Total Time 43.36s (± 0.38%) 43.41s (± 0.25%) ~ 43.25s 43.54s p=0.521 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,230,762 1,230,884 +122 (+ 0.01%) ~ ~ p=0.001 n=6
Types 261,187 261,272 +85 (+ 0.03%) ~ ~ p=0.001 n=6
Memory used 2,423,016k (± 0.03%) 2,422,796k (± 0.02%) ~ 2,421,965k 2,423,472k p=0.378 n=6
Parse Time 7.71s (± 0.56%) 7.71s (± 0.60%) ~ 7.67s 7.79s p=0.936 n=6
Bind Time 2.50s (± 0.86%) 2.51s (± 0.53%) ~ 2.49s 2.53s p=0.332 n=6
Check Time 49.53s (± 0.40%) 49.53s (± 0.25%) ~ 49.41s 49.74s p=0.936 n=6
Emit Time 3.86s (± 2.06%) 3.90s (± 2.78%) ~ 3.74s 4.03s p=0.689 n=6
Total Time 63.63s (± 0.30%) 63.66s (± 0.20%) ~ 63.53s 63.88s p=0.810 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 258,573 258,690 +117 (+ 0.05%) ~ ~ p=0.001 n=6
Types 104,819 104,890 +71 (+ 0.07%) ~ ~ p=0.001 n=6
Memory used 428,178k (± 0.01%) 428,374k (± 0.00%) +197k (+ 0.05%) 428,341k 428,397k p=0.005 n=6
Parse Time 3.31s (± 0.56%) 3.33s (± 0.58%) ~ 3.31s 3.36s p=0.120 n=6
Bind Time 1.32s (± 1.58%) 1.32s (± 1.41%) ~ 1.29s 1.34s p=1.000 n=6
Check Time 17.75s (± 0.20%) 17.77s (± 0.56%) ~ 17.67s 17.89s p=0.746 n=6
Emit Time 1.37s (± 1.81%) 1.37s (± 0.85%) ~ 1.35s 1.38s p=0.681 n=6
Total Time 23.73s (± 0.26%) 23.78s (± 0.38%) ~ 23.67s 23.89s p=0.467 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 224,565 224,675 +110 (+ 0.05%) ~ ~ p=0.001 n=6
Types 93,734 93,805 +71 (+ 0.08%) ~ ~ p=0.001 n=6
Memory used 369,473k (± 0.03%) 369,626k (± 0.04%) ~ 369,439k 369,828k p=0.066 n=6
Parse Time 2.78s (± 0.95%) 2.78s (± 1.00%) ~ 2.74s 2.81s p=0.871 n=6
Bind Time 1.58s (± 0.53%) 1.58s (± 1.17%) ~ 1.57s 1.62s p=0.325 n=6
Check Time 15.45s (± 0.29%) 15.47s (± 0.20%) ~ 15.42s 15.51s p=0.520 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 19.82s (± 0.16%) 19.83s (± 0.29%) ~ 19.72s 19.88s p=0.145 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=NaN n=0
Symbols 0 0 ~ ~ ~ p=NaN n=0
Types 0 0 ~ ~ ~ p=NaN n=0
Memory used 0k 0k ~ ~ ~ p=NaN n=0
Parse Time 0s 0s ~ ~ ~ p=NaN n=0
Bind Time 0s 0s ~ ~ ~ p=NaN n=0
Check Time 0s 0s ~ ~ ~ p=NaN n=0
Emit Time 0s 0s ~ ~ ~ p=NaN n=0
Total Time 0s 0s ~ ~ ~ p=NaN n=0
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 267,116 267,119 +3 (+ 0.00%) ~ ~ p=0.001 n=6
Types 108,756 108,757 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 411,518k (± 0.01%) 411,609k (± 0.03%) ~ 411,523k 411,825k p=0.093 n=6
Parse Time 3.82s (± 0.33%) 3.81s (± 0.55%) ~ 3.79s 3.84s p=0.325 n=6
Bind Time 1.70s (± 0.69%) 1.69s (± 0.53%) ~ 1.68s 1.70s p=0.270 n=6
Check Time 16.74s (± 0.47%) 16.75s (± 0.57%) ~ 16.62s 16.88s p=0.873 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 22.26s (± 0.32%) 22.25s (± 0.47%) ~ 22.10s 22.40s p=1.000 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 523,765 523,005 -760 (- 0.15%) ~ ~ p=0.001 n=6
Types 178,055 178,065 +10 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 461,594k (± 0.07%) 461,628k (± 0.06%) ~ 461,208k 461,961k p=0.575 n=6
Parse Time 3.94s (± 0.27%) 3.93s (± 0.65%) ~ 3.90s 3.96s p=0.466 n=6
Bind Time 1.47s (± 0.71%) 1.47s (± 0.71%) ~ 1.46s 1.49s p=1.000 n=6
Check Time 22.20s (± 0.36%) 22.26s (± 0.53%) ~ 22.10s 22.44s p=0.295 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 27.61s (± 0.26%) 27.67s (± 0.47%) ~ 27.49s 27.84s p=0.574 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/58910/merge:

Something interesting changed - please have a look.

Details

alan2207/bulletproof-react

tsconfig.json

apollographql/apollo-client

1 of 12 projects failed to build with the old tsc and were ignored

tsconfig.json

src/tsconfig.json

invoke-ai/InvokeAI

invokeai/frontend/web/tsconfig.json

mattermost/mattermost

1 of 4 projects failed to build with the old tsc and were ignored

webapp/channels/tsconfig.json

@typescript-bot
Copy link
Collaborator

@jakebailey Here are some more interesting changes from running the top 400 repos suite

Details

microsoft/vscode

5 of 54 projects failed to build with the old tsc and were ignored

src/tsconfig.tsec.json

@typescript-bot
Copy link
Collaborator

@jakebailey Here are some more interesting changes from running the top 400 repos suite

Details

pixijs/pixijs

tsconfig.types.json

tsconfig.json

recharts/recharts

1 of 4 projects failed to build with the old tsc and were ignored

storybook/tsconfig.json

tailwindlabs/headlessui

1 of 5 projects failed to build with the old tsc and were ignored

packages/@headlessui-react/tsconfig.json

@gabritto
Copy link
Member

gabritto commented Jul 3, 2024

This had a ton of breaks on the extended tests, so seems like not a good idea?

@Andarist
Copy link
Contributor Author

Andarist commented Jul 3, 2024

yep, might not be a good idea after all - I didn't yet look at those breaks though, at the very least I'd like to get some new test cases based on them so we could add them to main

@Andarist
Copy link
Contributor Author

Slimmed down repro based on headlessui:

type Query = (
  container: HTMLElement,
  ...args: any[]
) =>
  | Error
  | HTMLElement
  | HTMLElement[]
  | Promise<HTMLElement[]>
  | Promise<HTMLElement>
  | null;

interface Queries {
  [T: string]: Query;
}

type FindByText<T extends HTMLElement = HTMLElement> = (
  container: HTMLElement,
  text: string,
) => Promise<T>;

declare function findByLabelText<T extends HTMLElement = HTMLElement>(
  ...args: Parameters<FindByText<T>>
): ReturnType<FindByText<T>>;

const queries = {
  findByLabelText,
};

type MapQueries<Q extends Queries = typeof queries> = {
  [P in keyof Q]: Q[P];
};

I didn't quite expect a change in any code like this... I'll continue investigating this.

@jakebailey
Copy link
Member

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 13, 2024

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

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

@jakebailey
Copy link
Member

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 13, 2024

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 @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/58910/merge:

Something interesting changed - please have a look.

Details

webpack

tsconfig.types.json

@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 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,153 62,153 ~ ~ ~ p=1.000 n=6
Types 50,242 50,243 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 193,441k (± 0.93%) 193,921k (± 1.00%) ~ 192,134k 195,755k p=0.936 n=6
Parse Time 1.31s (± 0.94%) 1.29s (± 0.42%) ~ 1.29s 1.30s p=0.152 n=6
Bind Time 0.71s 0.71s ~ ~ ~ p=1.000 n=6
Check Time 9.46s (± 0.52%) 9.46s (± 0.35%) ~ 9.43s 9.52s p=0.683 n=6
Emit Time 2.75s (± 0.44%) 2.76s (± 0.96%) ~ 2.72s 2.79s p=0.684 n=6
Total Time 14.23s (± 0.29%) 14.22s (± 0.35%) ~ 14.17s 14.31s p=0.455 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 944,114 944,115 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Types 407,050 407,073 +23 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 1,218,382k (± 0.01%) 1,218,396k (± 0.00%) ~ 1,218,329k 1,218,452k p=0.936 n=6
Parse Time 6.71s (± 0.72%) 6.70s (± 0.39%) ~ 6.66s 6.74s p=0.936 n=6
Bind Time 1.87s (± 1.07%) 1.88s (± 0.29%) ~ 1.87s 1.88s p=0.855 n=6
Check Time 30.61s (± 0.37%) 30.63s (± 0.29%) ~ 30.48s 30.72s p=1.000 n=6
Emit Time 13.64s (± 0.40%) 13.59s (± 0.28%) ~ 13.53s 13.64s p=0.173 n=6
Total Time 52.83s (± 0.33%) 52.79s (± 0.13%) ~ 52.66s 52.85s p=0.810 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,148,730 2,149,048 +318 (+ 0.01%) ~ ~ p=0.001 n=6
Types 929,320 929,397 +77 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 2,116,434k (± 0.00%) 2,116,472k (± 0.00%) ~ 2,116,400k 2,116,514k p=0.093 n=6
Parse Time 6.58s (± 0.23%) 6.58s (± 0.24%) ~ 6.55s 6.59s p=0.869 n=6
Bind Time 2.33s (± 0.22%) 2.32s (± 0.18%) ~ 2.32s 2.33s p=0.112 n=6
Check Time 70.77s (± 0.37%) 70.59s (± 0.40%) ~ 70.21s 70.95s p=0.296 n=6
Emit Time 0.14s (± 2.95%) 0.14s (± 2.88%) ~ 0.14s 0.15s p=0.218 n=6
Total Time 79.81s (± 0.33%) 79.63s (± 0.34%) ~ 79.26s 79.95s p=0.297 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,948 1,226,061 +113 (+ 0.01%) ~ ~ p=0.001 n=6
Types 261,589 261,671 +82 (+ 0.03%) ~ ~ p=0.001 n=6
Memory used 2,338,519k (± 0.02%) 2,339,208k (± 0.02%) +689k (+ 0.03%) 2,338,645k 2,339,759k p=0.045 n=6
Parse Time 5.09s (± 0.75%) 5.08s (± 0.93%) ~ 5.03s 5.14s p=0.810 n=6
Bind Time 1.90s (± 0.55%) 1.91s (± 0.86%) ~ 1.89s 1.93s p=0.361 n=6
Check Time 34.12s (± 0.22%) 34.15s (± 0.26%) ~ 34.00s 34.25s p=0.471 n=6
Emit Time 3.25s (± 1.55%) 3.23s (± 1.54%) ~ 3.19s 3.32s p=0.521 n=6
Total Time 44.36s (± 0.24%) 44.38s (± 0.27%) ~ 44.18s 44.53s p=0.936 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,948 1,226,061 +113 (+ 0.01%) ~ ~ p=0.001 n=6
Types 261,589 261,671 +82 (+ 0.03%) ~ ~ p=0.001 n=6
Memory used 2,412,934k (± 0.03%) 2,413,338k (± 0.02%) ~ 2,412,916k 2,414,274k p=0.230 n=6
Parse Time 6.36s (± 0.43%) 6.32s (± 0.61%) ~ 6.28s 6.38s p=0.092 n=6
Bind Time 2.05s (± 0.73%) 2.05s (± 1.51%) ~ 2.02s 2.10s p=0.808 n=6
Check Time 40.74s (± 0.29%) 40.72s (± 0.30%) ~ 40.55s 40.86s p=0.936 n=6
Emit Time 3.98s (± 2.20%) 3.92s (± 1.32%) ~ 3.82s 3.96s p=0.688 n=6
Total Time 53.12s (± 0.31%) 53.01s (± 0.29%) ~ 52.80s 53.22s p=0.471 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 258,230 258,344 +114 (+ 0.04%) ~ ~ p=0.001 n=6
Types 104,789 104,859 +70 (+ 0.07%) ~ ~ p=0.001 n=6
Memory used 427,124k (± 0.04%) 427,324k (± 0.06%) +200k (+ 0.05%) 427,089k 427,757k p=0.031 n=6
Parse Time 3.30s (± 0.37%) 3.30s (± 0.65%) ~ 3.28s 3.33s p=0.871 n=6
Bind Time 1.31s (± 0.75%) 1.31s (± 0.62%) ~ 1.30s 1.32s p=0.394 n=6
Check Time 17.79s (± 0.54%) 17.85s (± 0.44%) ~ 17.74s 17.96s p=0.296 n=6
Emit Time 1.64s (± 1.00%) 1.65s (± 1.13%) ~ 1.63s 1.68s p=0.366 n=6
Total Time 24.04s (± 0.41%) 24.11s (± 0.33%) ~ 23.98s 24.21s p=0.336 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 224,565 224,672 +107 (+ 0.05%) ~ ~ p=0.001 n=6
Types 93,734 93,803 +69 (+ 0.07%) ~ ~ p=0.001 n=6
Memory used 369,481k (± 0.02%) 369,665k (± 0.02%) +184k (+ 0.05%) 369,564k 369,735k p=0.013 n=6
Parse Time 3.43s (± 0.81%) 3.45s (± 0.72%) ~ 3.41s 3.48s p=0.373 n=6
Bind Time 1.93s (± 0.54%) 1.94s (± 0.70%) ~ 1.92s 1.95s p=0.190 n=6
Check Time 19.18s (± 0.42%) 19.19s (± 0.41%) ~ 19.09s 19.28s p=1.000 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.54s (± 0.30%) 24.57s (± 0.40%) ~ 24.47s 24.70s p=0.748 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,891,160 2,890,945 -215 (- 0.01%) ~ ~ p=0.001 n=6
Types 978,184 978,308 +124 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 3,055,016k (± 0.00%) 3,055,037k (± 0.00%) ~ 3,054,933k 3,055,099k p=0.521 n=6
Parse Time 16.95s (± 0.25%) 16.98s (± 0.42%) ~ 16.90s 17.06s p=0.572 n=6
Bind Time 5.13s (± 0.68%) 5.11s (± 0.49%) ~ 5.08s 5.15s p=0.147 n=6
Check Time 89.68s (± 0.32%) 89.96s (± 0.21%) +0.28s (+ 0.32%) 89.68s 90.20s p=0.045 n=6
Emit Time 29.27s (± 1.17%) 29.26s (± 0.81%) ~ 29.00s 29.64s p=0.810 n=6
Total Time 141.03s (± 0.37%) 141.31s (± 0.20%) ~ 140.96s 141.57s p=0.378 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 267,239 267,242 +3 (+ 0.00%) ~ ~ p=0.001 n=6
Types 108,815 108,816 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 411,842k (± 0.03%) 411,805k (± 0.01%) ~ 411,736k 411,838k p=0.936 n=6
Parse Time 4.74s (± 0.41%) 4.75s (± 0.53%) ~ 4.72s 4.78s p=0.805 n=6
Bind Time 2.09s (± 0.63%) 2.09s (± 0.88%) ~ 2.06s 2.11s p=0.805 n=6
Check Time 20.80s (± 0.32%) 20.79s (± 0.47%) ~ 20.62s 20.89s p=0.809 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 27.63s (± 0.20%) 27.63s (± 0.39%) ~ 27.48s 27.76s p=0.936 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 510,479 510,479 ~ ~ ~ p=1.000 n=6
Types 161,600 161,600 ~ ~ ~ p=1.000 n=6
Memory used 448,051k (± 0.05%) 447,989k (± 0.07%) ~ 447,701k 448,370k p=0.689 n=6
Parse Time 3.15s (± 0.52%) 3.15s (± 1.04%) ~ 3.12s 3.21s p=0.870 n=6
Bind Time 1.17s (± 0.47%) 1.17s (± 0.44%) ~ 1.16s 1.17s p=0.640 n=6
Check Time 17.04s (± 0.46%) 17.08s (± 0.29%) ~ 17.03s 17.17s p=0.871 n=6
Emit Time 0.00s 0.00s (±244.70%) ~ 0.00s 0.02s p=0.405 n=6
Total Time 21.35s (± 0.39%) 21.40s (± 0.39%) ~ 21.34s 21.56s p=0.748 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/58910/merge:

Everything looks good!

@Andarist
Copy link
Contributor Author

@gabritto I made a very silly mistake initially. It was somewhat a coincidence that the tests I had passed 😅 This was fixed now and I added extra test cases. The PR is now in a good state and can be reviewed :)

Above we can see some missing implicit anys in webpack. I added a test case based on that, this is a clear improvement.

@ehoogeveen-medweb
Copy link

Aside from the new return type branch, it seems like this also changes the !inferredType case to always use instantiatedConstraint instead of checking whether fallbackType satisfies the constraint. Is that an intended part of this change?

@Andarist
Copy link
Contributor Author

No, that wasn't intentional. Thanks for pointing that out - I corrected the PR but I doubt it will make a difference for any of the extended tests.

@Andarist
Copy link
Contributor Author

Andarist commented Sep 9, 2024

@gabritto @weswigham friendly 🏓 :)

@jakebailey
Copy link
Member

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Dec 3, 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 Dec 3, 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/166662/artifacts?artifactName=tgz&fileId=693963D0F3462F9DA7B216A2F4CA1FE21B74A54DA9BD4DF8CC521F9665196C0A02&fileName=/typescript-6.0.0-insiders.20251203.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/pr-build@6.0.0-pr-58910-25".;

@jakebailey
Copy link
Member

Just to note it, this code now matches the fix that Anders applied separately in the Go codebase, so this should be good as-is now, yay.

@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/58910/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 1 1 ~ ~ ~ p=1.000 n=6
Symbols 62,370 62,370 ~ ~ ~ p=1.000 n=6
Types 50,386 50,387 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 195,139k (± 0.99%) 193,882k (± 0.92%) ~ 192,596k 196,236k p=0.230 n=6
Parse Time 1.31s (± 0.48%) 1.30s (± 0.76%) ~ 1.29s 1.31s p=0.058 n=6
Bind Time 0.75s 0.75s (± 0.54%) ~ 0.74s 0.75s p=0.405 n=6
Check Time 9.90s (± 0.28%) 9.92s (± 0.29%) ~ 9.86s 9.94s p=0.517 n=6
Emit Time 2.75s (± 0.74%) 2.75s (± 0.76%) ~ 2.72s 2.77s p=0.935 n=6
Total Time 14.71s (± 0.25%) 14.71s (± 0.15%) ~ 14.69s 14.74s p=0.747 n=6
angular-1 - node (v18.15.0, x64)
Errors 2 2 ~ ~ ~ p=1.000 n=6
Symbols 956,047 956,048 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Types 415,881 415,904 +23 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 1,255,027k (± 0.00%) 1,255,030k (± 0.01%) ~ 1,254,927k 1,255,137k p=1.000 n=6
Parse Time 6.54s (± 0.70%) 6.55s (± 0.73%) ~ 6.50s 6.61s p=0.520 n=6
Bind Time 1.96s (± 0.21%) 1.96s (± 0.21%) ~ 1.95s 1.96s p=0.218 n=6
Check Time 32.37s (± 0.29%) 32.37s (± 0.25%) ~ 32.24s 32.47s p=1.000 n=6
Emit Time 14.90s (± 0.38%) 14.90s (± 0.18%) ~ 14.86s 14.93s p=0.935 n=6
Total Time 55.77s (± 0.21%) 55.78s (± 0.20%) ~ 55.62s 55.93s p=1.000 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,722,079 2,722,114 +35 (+ 0.00%) ~ ~ p=0.001 n=6
Types 937,469 937,543 +74 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 3,050,903k (± 0.00%) 3,050,957k (± 0.00%) ~ 3,050,816k 3,051,093k p=0.336 n=6
Parse Time 8.56s (± 0.41%) 8.55s (± 0.17%) ~ 8.53s 8.57s p=0.807 n=6
Bind Time 2.31s (± 0.61%) 2.32s (± 0.85%) ~ 2.29s 2.34s p=0.568 n=6
Check Time 93.15s (± 0.47%) 93.10s (± 0.56%) ~ 92.60s 94.01s p=0.748 n=6
Emit Time 0.31s (± 1.32%) 0.31s (± 2.41%) ~ 0.30s 0.32s p=0.389 n=6
Total Time 104.33s (± 0.41%) 104.27s (± 0.50%) ~ 103.76s 105.17s p=0.689 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,251,545 1,251,654 +109 (+ 0.01%) ~ ~ p=0.001 n=6
Types 259,756 259,840 +84 (+ 0.03%) ~ ~ p=0.001 n=6
Memory used 2,514,090k (±11.83%) 2,575,509k (±11.82%) ~ 2,392,682k 3,121,821k p=0.093 n=6
Parse Time 5.21s (± 0.85%) 5.18s (± 1.23%) ~ 5.11s 5.29s p=0.470 n=6
Bind Time 1.81s (± 0.45%) 1.82s (± 0.73%) +0.02s (+ 0.83%) 1.81s 1.84s p=0.029 n=6
Check Time 35.57s (± 0.61%) 35.55s (± 1.02%) ~ 34.89s 35.90s p=0.872 n=6
Emit Time 2.99s (± 0.86%) 2.98s (± 1.59%) ~ 2.94s 3.07s p=0.298 n=6
Total Time 45.59s (± 0.49%) 45.53s (± 0.82%) ~ 44.88s 45.94s p=0.873 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,251,545 1,251,654 +109 (+ 0.01%) ~ ~ p=0.001 n=6
Types 259,756 259,840 +84 (+ 0.03%) ~ ~ p=0.001 n=6
Memory used 3,093,443k (± 7.47%) 3,188,839k (± 0.03%) ~ 3,187,697k 3,190,679k p=0.093 n=6
Parse Time 6.82s (± 1.30%) 6.84s (± 0.79%) ~ 6.77s 6.92s p=0.748 n=6
Bind Time 2.24s (± 2.28%) 2.27s (± 1.31%) ~ 2.24s 2.32s p=0.470 n=6
Check Time 42.98s (± 0.89%) 43.15s (± 0.31%) ~ 42.98s 43.34s p=0.471 n=6
Emit Time 3.52s (± 2.82%) 3.44s (± 3.39%) ~ 3.34s 3.64s p=0.173 n=6
Total Time 55.56s (± 0.87%) 55.71s (± 0.45%) ~ 55.38s 56.12s p=1.000 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 264,177 264,287 +110 (+ 0.04%) ~ ~ p=0.001 n=6
Types 103,979 104,051 +72 (+ 0.07%) ~ ~ p=0.001 n=6
Memory used 443,171k (± 0.01%) 443,350k (± 0.01%) +179k (+ 0.04%) 443,305k 443,411k p=0.005 n=6
Parse Time 3.53s (± 0.73%) 3.53s (± 0.51%) ~ 3.51s 3.56s p=0.685 n=6
Bind Time 1.39s (± 0.91%) 1.38s (± 0.76%) ~ 1.37s 1.40s p=0.456 n=6
Check Time 19.25s (± 0.35%) 19.23s (± 0.61%) ~ 19.13s 19.41s p=0.470 n=6
Emit Time 1.54s (± 1.48%) 1.54s (± 0.95%) ~ 1.52s 1.56s p=0.935 n=6
Total Time 25.71s (± 0.29%) 25.69s (± 0.50%) ~ 25.56s 25.89s p=0.575 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 72 72 ~ ~ ~ p=1.000 n=6
Symbols 225,386 225,493 +107 (+ 0.05%) ~ ~ p=0.001 n=6
Types 94,304 94,373 +69 (+ 0.07%) ~ ~ p=0.001 n=6
Memory used 370,170k (± 0.04%) 370,318k (± 0.05%) ~ 370,088k 370,631k p=0.128 n=6
Parse Time 2.84s (± 1.11%) 2.83s (± 0.80%) ~ 2.81s 2.87s p=0.808 n=6
Bind Time 1.64s (± 0.81%) 1.64s (± 1.16%) ~ 1.61s 1.66s p=0.867 n=6
Check Time 16.62s (± 0.36%) 16.67s (± 0.61%) ~ 16.57s 16.81s p=0.418 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 21.09s (± 0.40%) 21.14s (± 0.45%) ~ 21.04s 21.27s p=0.521 n=6
vscode - node (v18.15.0, x64)
Errors 11 11 ~ ~ ~ p=1.000 n=6
Symbols 4,074,593 4,073,903 -690 (- 0.02%) ~ ~ p=0.001 n=6
Types 1,283,160 1,283,379 +219 (+ 0.02%) ~ ~ p=0.001 n=6
Memory used 3,860,122k (± 0.00%) 3,860,044k (± 0.00%) ~ 3,859,844k 3,860,220k p=0.378 n=6
Parse Time 15.57s (± 0.20%) 15.62s (± 0.62%) ~ 15.55s 15.79s p=0.686 n=6
Bind Time 5.26s (± 0.80%) 5.27s (± 1.87%) ~ 5.20s 5.46s p=0.419 n=6
Check Time 111.07s (± 1.74%) 112.52s (± 2.22%) ~ 109.69s 117.14s p=0.689 n=6
Emit Time 41.95s (±13.66%) 42.55s (±11.19%) ~ 37.96s 50.34s p=0.689 n=6
Total Time 173.86s (± 2.54%) 175.96s (± 3.87%) ~ 168.90s 188.37s p=0.936 n=6
webpack - node (v18.15.0, x64)
Errors 40 40 ~ ~ ~ p=1.000 n=6
Symbols 380,751 380,758 +7 (+ 0.00%) ~ ~ p=0.001 n=6
Types 166,810 166,811 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 540,863k (± 0.02%) 540,910k (± 0.02%) ~ 540,715k 541,099k p=0.471 n=6
Parse Time 4.72s (± 0.39%) 4.71s (± 0.64%) ~ 4.67s 4.75s p=0.935 n=6
Bind Time 2.04s (± 0.59%) 2.04s (± 2.45%) ~ 1.98s 2.12s p=1.000 n=6
Check Time 22.99s (± 0.42%) 22.97s (± 0.43%) ~ 22.83s 23.13s p=0.687 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 29.75s (± 0.37%) 29.72s (± 0.49%) ~ 29.47s 29.86s p=0.810 n=6
xstate-main - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 692,890 692,890 ~ ~ ~ p=1.000 n=6
Types 210,398 210,398 ~ ~ ~ p=1.000 n=6
Memory used 588,879k (± 0.03%) 588,937k (± 0.02%) ~ 588,761k 589,074k p=0.471 n=6
Parse Time 4.16s (± 1.03%) 4.18s (± 0.69%) ~ 4.13s 4.21s p=0.228 n=6
Bind Time 1.41s (± 1.04%) 1.41s (± 1.06%) ~ 1.40s 1.43s p=0.615 n=6
Check Time 21.10s (± 1.91%) 21.11s (± 2.07%) ~ 20.66s 21.56s p=1.000 n=6
Emit Time 0.00s 0.01s (±109.43%) ~ 0.00s 0.01s p=0.071 n=6
Total Time 26.67s (± 1.43%) 26.72s (± 1.73%) ~ 26.21s 27.19s p=0.688 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/58910/merge:

Something interesting changed - please have a look.

Details

refined-github/refined-github

tsconfig.json

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

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

Cross comparing typescript-go, and this is matching.

@github-project-automation github-project-automation bot moved this from Waiting on author to Needs merge in PR Backlog Dec 3, 2025
@jakebailey jakebailey merged commit 28fbc0a into microsoft:main Dec 3, 2025
33 checks passed
@github-project-automation github-project-automation bot moved this from Needs merge to Done in PR Backlog Dec 3, 2025
@Andarist Andarist deleted the fix/filter-out-return-type-inference-by-constraint-applicability branch December 3, 2025 18:19
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: Done

6 participants