Skip to content

Consider index signatures as optional properties in contextual type discrimination #54596

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

Merged
merged 7 commits into from
Jun 13, 2023

Conversation

gabritto
Copy link
Member

Fixes #54498.
The fix is suggested and described by @nebkat in this comment: #54498 (comment).

When we try to discriminate a contextual type, we consider the omission of a property to be a factor to discriminate in discriminateTypeByDiscriminableItems's implementation, but then during that process, when looking up a property in one of the candidate types, we would not consider matching index signatures and therefore we would discard the type with the index signature. Now, when looking up a property in one of the candidate types, we also consider matching on index signatures.

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Jun 10, 2023
@@ -22719,6 +22719,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
const filtered = contains(include, Ternary.False) ? getUnionType(types.filter((_, i) => include[i])) : target;
return filtered.flags & TypeFlags.Never ? target : filtered;

function getTypeOfPropertyOrOptionalIndexSignature(type: Type, name: __String): Type | undefined {
Copy link
Member Author

Choose a reason for hiding this comment

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

I feel like this function might already exist, but I couldn't find it.

Copy link
Member

@DanielRosenwasser DanielRosenwasser Jun 12, 2023

Choose a reason for hiding this comment

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

There's getTypeOfPropertyOrIndexSignature (used by narrowTypeByDiscriminant!). Consider replacing that function and making it take a parameter on whether to add optionality for index signatures.

@gabritto
Copy link
Member Author

@typescript-bot test this
@typescript-bot run DT
@typescript-bot user test this
@typescript-bot test top100
@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 10, 2023

Heya @gabritto, I've started to run the parallelized Definitely Typed test suite on this PR at c66c0d1. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 10, 2023

Heya @gabritto, I've started to run the diff-based user code test suite on this PR at c66c0d1. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 10, 2023

Heya @gabritto, I've started to run the extended test suite on this PR at c66c0d1. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 10, 2023

Heya @gabritto, I've started to run the perf test suite on this PR at c66c0d1. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 10, 2023

Heya @gabritto, I've started to run the diff-based top-repos suite on this PR at c66c0d1. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

@gabritto Here are the results of running the user test suite comparing main and refs/pull/54596/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Unknown failure"
  • 1 instance of "Package install failed"

Otherwise...

Something interesting changed - please have a look.

Details

rxjs-src

/mnt/ts_downloads/rxjs-src/build.sh

  • [NEW] error TS2428: All declarations of 'WeakMap' must have identical type parameters.
    • /home/vsts/work/1/s/typescript-54596/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-54596/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-54596/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-54596/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-54596/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-54596/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-54596/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-54596/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-54596/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-54596/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-54596/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-54596/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-54596/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-54596/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-54596/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
  • [MISSING] error TS2428: All declarations of 'WeakMap' must have identical type parameters.
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)

@typescript-bot
Copy link
Collaborator

@gabritto
The results of the perf run you requested are in!

Here they are:

Compiler

Comparison Report - main..54596
Metric main 54596 Delta Best Worst p-value
Angular - node (v18.10.0, x64)
Memory used 366,149k (± 0.01%) 366,155k (± 0.01%) ~ 366,131k 366,186k p=1.000 n=6
Parse Time 3.42s (± 0.78%) 3.41s (± 0.71%) ~ 3.39s 3.45s p=0.870 n=6
Bind Time 1.12s (± 0.36%) 1.11s (± 1.23%) ~ 1.10s 1.13s p=0.490 n=6
Check Time 8.76s (± 0.51%) 8.77s (± 0.43%) ~ 8.72s 8.80s p=0.683 n=6
Emit Time 7.45s (± 1.15%) 7.45s (± 0.51%) ~ 7.42s 7.52s p=0.569 n=6
Total Time 20.74s (± 0.56%) 20.75s (± 0.32%) ~ 20.67s 20.86s p=0.689 n=6
Compiler-Unions - node (v18.10.0, x64)
Memory used 192,156k (± 1.24%) 193,997k (± 1.60%) ~ 191,151k 196,946k p=0.810 n=6
Parse Time 1.51s (± 0.91%) 1.51s (± 1.29%) ~ 1.48s 1.53s p=0.804 n=6
Bind Time 0.77s (± 0.53%) 0.77s (± 0.53%) ~ 0.76s 0.77s p=0.218 n=6
Check Time 9.47s (± 0.43%) 9.48s (± 0.52%) ~ 9.43s 9.55s p=0.687 n=6
Emit Time 2.75s (± 1.16%) 2.74s (± 1.69%) ~ 2.68s 2.81s p=0.629 n=6
Total Time 14.50s (± 0.39%) 14.50s (± 0.73%) ~ 14.38s 14.64s p=1.000 n=6
Monaco - node (v18.10.0, x64)
Memory used 346,626k (± 0.01%) 346,620k (± 0.01%) ~ 346,567k 346,677k p=0.936 n=6
Parse Time 2.59s (± 0.57%) 2.59s (± 1.24%) ~ 2.56s 2.64s p=0.808 n=6
Bind Time 1.01s (± 0.81%) 1.01s (± 1.02%) ~ 0.99s 1.02s p=0.932 n=6
Check Time 7.13s (± 0.56%) 7.14s (± 0.36%) ~ 7.11s 7.17s p=0.809 n=6
Emit Time 4.24s (± 0.65%) 4.27s (± 0.87%) ~ 4.23s 4.33s p=0.101 n=6
Total Time 14.98s (± 0.41%) 15.01s (± 0.42%) ~ 14.93s 15.12s p=0.376 n=6
TFS - node (v18.10.0, x64)
Memory used 300,628k (± 0.01%) 300,645k (± 0.01%) ~ 300,624k 300,683k p=0.199 n=6
Parse Time 2.05s (± 1.00%) 2.05s (± 0.69%) ~ 2.03s 2.07s p=0.739 n=6
Bind Time 1.14s (± 0.00%) 1.14s (± 1.03%) ~ 1.12s 1.15s p=1.000 n=6
Check Time 6.60s (± 0.45%) 6.64s (± 0.46%) +0.04s (+ 0.63%) 6.60s 6.67s p=0.045 n=6
Emit Time 3.85s (± 0.83%) 3.87s (± 0.70%) ~ 3.83s 3.90s p=0.294 n=6
Total Time 13.65s (± 0.32%) 13.70s (± 0.38%) ~ 13.62s 13.76s p=0.076 n=6
material-ui - node (v18.10.0, x64)
Memory used 481,761k (± 0.01%) 481,766k (± 0.01%) ~ 481,723k 481,800k p=0.873 n=6
Parse Time 3.10s (± 0.70%) 3.12s (± 0.74%) ~ 3.08s 3.15s p=0.329 n=6
Bind Time 0.91s (± 0.82%) 0.91s (± 0.45%) ~ 0.91s 0.92s p=1.000 n=6
Check Time 16.82s (± 0.56%) 16.93s (± 1.08%) ~ 16.75s 17.20s p=0.470 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 20.84s (± 0.45%) 20.96s (± 0.88%) ~ 20.78s 21.22s p=0.470 n=6
xstate - node (v18.10.0, x64)
Memory used 563,211k (± 0.02%) 563,053k (± 0.02%) ~ 562,911k 563,266k p=0.066 n=6
Parse Time 3.81s (± 0.52%) 3.82s (± 0.69%) ~ 3.79s 3.86s p=0.572 n=6
Bind Time 1.62s (± 0.55%) 1.63s (± 0.63%) ~ 1.62s 1.64s p=0.345 n=6
Check Time 2.82s (± 0.73%) 2.82s (± 0.92%) ~ 2.79s 2.86s p=0.872 n=6
Emit Time 0.08s (± 0.00%) 0.08s (± 0.00%) ~ 0.08s 0.08s p=1.000 n=6
Total Time 8.32s (± 0.40%) 8.35s (± 0.46%) ~ 8.30s 8.39s p=0.418 n=6
Angular - node (v16.17.1, x64)
Memory used 365,545k (± 0.01%) 365,533k (± 0.01%) ~ 365,467k 365,582k p=0.748 n=6
Parse Time 3.55s (± 0.23%) 3.57s (± 0.52%) ~ 3.53s 3.58s p=0.061 n=6
Bind Time 1.18s (± 0.76%) 1.18s (± 0.64%) ~ 1.17s 1.19s p=0.798 n=6
Check Time 9.57s (± 0.22%) 9.60s (± 0.31%) ~ 9.57s 9.65s p=0.103 n=6
Emit Time 7.89s (± 0.30%) 7.94s (± 1.00%) ~ 7.81s 8.06s p=0.065 n=6
Total Time 22.20s (± 0.19%) 22.28s (± 0.46%) ~ 22.09s 22.39s p=0.077 n=6
Compiler-Unions - node (v16.17.1, x64)
Memory used 192,898k (± 0.02%) 192,970k (± 0.03%) +72k (+ 0.04%) 192,904k 193,045k p=0.031 n=6
Parse Time 1.60s (± 0.65%) 1.59s (± 1.62%) ~ 1.56s 1.63s p=1.000 n=6
Bind Time 0.83s (± 0.62%) 0.83s (± 0.49%) ~ 0.82s 0.83s p=0.595 n=6
Check Time 10.17s (± 0.75%) 10.21s (± 0.71%) ~ 10.13s 10.31s p=0.748 n=6
Emit Time 3.00s (± 0.93%) 3.01s (± 0.98%) ~ 2.96s 3.04s p=0.809 n=6
Total Time 15.60s (± 0.58%) 15.64s (± 0.59%) ~ 15.53s 15.75s p=0.575 n=6
Monaco - node (v16.17.1, x64)
Memory used 345,892k (± 0.00%) 345,895k (± 0.00%) ~ 345,874k 345,916k p=0.689 n=6
Parse Time 2.71s (± 0.20%) 2.73s (± 0.76%) ~ 2.70s 2.76s p=0.360 n=6
Bind Time 1.08s (± 0.70%) 1.09s (± 1.07%) ~ 1.08s 1.11s p=0.383 n=6
Check Time 7.83s (± 0.31%) 7.84s (± 0.39%) ~ 7.81s 7.88s p=0.936 n=6
Emit Time 4.43s (± 0.23%) 4.49s (± 0.42%) +0.06s (+ 1.28%) 4.47s 4.52s p=0.005 n=6
Total Time 16.06s (± 0.15%) 16.15s (± 0.36%) +0.09s (+ 0.56%) 16.07s 16.21s p=0.010 n=6
TFS - node (v16.17.1, x64)
Memory used 299,974k (± 0.01%) 299,974k (± 0.01%) ~ 299,942k 299,990k p=0.936 n=6
Parse Time 2.15s (± 0.54%) 2.16s (± 0.65%) ~ 2.14s 2.18s p=0.357 n=6
Bind Time 1.24s (± 1.35%) 1.24s (± 0.98%) ~ 1.22s 1.25s p=0.742 n=6
Check Time 7.26s (± 0.47%) 7.31s (± 0.36%) +0.05s (+ 0.71%) 7.28s 7.35s p=0.036 n=6
Emit Time 4.36s (± 1.01%) 4.35s (± 0.96%) ~ 4.28s 4.40s p=0.573 n=6
Total Time 15.02s (± 0.55%) 15.05s (± 0.26%) ~ 15.00s 15.11s p=0.521 n=6
material-ui - node (v16.17.1, x64)
Memory used 481,041k (± 0.01%) 480,994k (± 0.01%) -47k (- 0.01%) 480,965k 481,024k p=0.031 n=6
Parse Time 3.25s (± 0.41%) 3.27s (± 0.25%) +0.02s (+ 0.56%) 3.26s 3.28s p=0.045 n=6
Bind Time 0.94s (± 0.67%) 0.94s (± 1.09%) ~ 0.93s 0.96s p=0.654 n=6
Check Time 17.96s (± 0.77%) 17.97s (± 0.67%) ~ 17.80s 18.10s p=0.936 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 22.14s (± 0.70%) 22.19s (± 0.58%) ~ 22.00s 22.32s p=0.575 n=6
xstate - node (v16.17.1, x64)
Memory used 560,679k (± 0.03%) 560,682k (± 0.01%) ~ 560,594k 560,789k p=0.471 n=6
Parse Time 3.99s (± 0.29%) 4.00s (± 0.34%) ~ 3.99s 4.02s p=0.073 n=6
Bind Time 1.75s (± 0.31%) 1.76s (± 1.18%) ~ 1.72s 1.78s p=0.866 n=6
Check Time 3.06s (± 0.48%) 3.05s (± 0.44%) ~ 3.04s 3.07s p=0.511 n=6
Emit Time 0.09s (± 0.00%) 0.09s (± 0.00%) ~ 0.09s 0.09s p=1.000 n=6
Total Time 8.89s (± 0.23%) 8.91s (± 0.43%) ~ 8.86s 8.95s p=0.627 n=6
Angular - node (v14.21.3, x64)
Memory used 359,532k (± 0.01%) 359,542k (± 0.01%) ~ 359,518k 359,576k p=0.423 n=6
Parse Time 3.65s (± 0.33%) 3.68s (± 0.53%) +0.03s (+ 0.78%) 3.66s 3.71s p=0.010 n=6
Bind Time 1.21s (± 0.45%) 1.22s (± 0.52%) ~ 1.21s 1.23s p=0.201 n=6
Check Time 10.00s (± 0.69%) 10.04s (± 0.35%) ~ 9.98s 10.09s p=0.127 n=6
Emit Time 8.32s (± 0.84%) 8.35s (± 0.83%) ~ 8.25s 8.43s p=0.378 n=6
Total Time 23.19s (± 0.53%) 23.29s (± 0.44%) ~ 23.17s 23.44s p=0.128 n=6
Compiler-Unions - node (v14.21.3, x64)
Memory used 188,302k (± 0.01%) 188,274k (± 0.02%) ~ 188,230k 188,344k p=0.078 n=6
Parse Time 1.60s (± 0.34%) 1.62s (± 0.76%) ~ 1.59s 1.62s p=0.053 n=6
Bind Time 0.84s (± 0.65%) 0.85s (± 0.89%) ~ 0.84s 0.86s p=0.476 n=6
Check Time 10.29s (± 0.67%) 10.34s (± 0.74%) ~ 10.20s 10.41s p=0.336 n=6
Emit Time 3.13s (± 0.79%) 3.13s (± 0.74%) ~ 3.10s 3.16s p=1.000 n=6
Total Time 15.87s (± 0.55%) 15.93s (± 0.60%) ~ 15.78s 16.05s p=0.297 n=6
Monaco - node (v14.21.3, x64)
Memory used 341,025k (± 0.01%) 341,029k (± 0.01%) ~ 340,961k 341,062k p=0.809 n=6
Parse Time 2.80s (± 0.49%) 2.81s (± 0.37%) ~ 2.80s 2.83s p=0.241 n=6
Bind Time 1.11s (± 0.37%) 1.11s (± 0.37%) ~ 1.11s 1.12s p=0.218 n=6
Check Time 8.16s (± 0.41%) 8.24s (± 0.84%) +0.08s (+ 0.96%) 8.16s 8.34s p=0.037 n=6
Emit Time 4.68s (± 0.80%) 4.71s (± 0.70%) ~ 4.66s 4.75s p=0.196 n=6
Total Time 16.75s (± 0.32%) 16.87s (± 0.46%) +0.12s (+ 0.72%) 16.80s 16.97s p=0.020 n=6
TFS - node (v14.21.3, x64)
Memory used 295,143k (± 0.00%) 295,150k (± 0.00%) ~ 295,145k 295,159k p=0.077 n=6
Parse Time 2.39s (± 0.98%) 2.41s (± 0.81%) ~ 2.39s 2.44s p=0.123 n=6
Bind Time 1.07s (± 2.18%) 1.07s (± 0.51%) ~ 1.06s 1.07s p=0.859 n=6
Check Time 7.58s (± 0.50%) 7.59s (± 0.49%) ~ 7.54s 7.65s p=0.572 n=6
Emit Time 4.34s (± 0.47%) 4.32s (± 0.81%) ~ 4.26s 4.36s p=0.373 n=6
Total Time 15.38s (± 0.40%) 15.39s (± 0.43%) ~ 15.29s 15.49s p=0.810 n=6
material-ui - node (v14.21.3, x64)
Memory used 476,575k (± 0.00%) 476,579k (± 0.01%) ~ 476,537k 476,613k p=0.689 n=6
Parse Time 3.33s (± 0.52%) 3.36s (± 0.40%) +0.03s (+ 0.80%) 3.34s 3.38s p=0.022 n=6
Bind Time 1.00s (± 0.75%) 1.01s (± 0.75%) ~ 1.00s 1.02s p=0.195 n=6
Check Time 18.64s (± 0.42%) 18.81s (± 0.65%) +0.18s (+ 0.95%) 18.64s 18.96s p=0.031 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 22.97s (± 0.37%) 23.18s (± 0.50%) +0.21s (+ 0.90%) 23.00s 23.33s p=0.008 n=6
xstate - node (v14.21.3, x64)
Memory used 549,695k (± 0.00%) 549,689k (± 0.00%) ~ 549,670k 549,706k p=0.689 n=6
Parse Time 4.23s (± 0.41%) 4.25s (± 0.38%) ~ 4.24s 4.28s p=0.124 n=6
Bind Time 1.67s (± 0.31%) 1.68s (± 0.82%) ~ 1.66s 1.70s p=0.242 n=6
Check Time 3.18s (± 0.77%) 3.18s (± 0.43%) ~ 3.15s 3.19s p=0.366 n=6
Emit Time 0.09s (± 0.00%) 0.09s (± 0.00%) ~ 0.09s 0.09s p=1.000 n=6
Total Time 9.16s (± 0.30%) 9.20s (± 0.24%) +0.04s (+ 0.38%) 9.18s 9.23s p=0.017 n=6
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-148-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v18.10.0, x64)
  • node (v16.17.1, x64)
  • node (v14.21.3, x64)
Scenarios
  • Angular - node (v18.10.0, x64)
  • Angular - node (v16.17.1, x64)
  • Angular - node (v14.21.3, x64)
  • Compiler-Unions - node (v18.10.0, x64)
  • Compiler-Unions - node (v16.17.1, x64)
  • Compiler-Unions - node (v14.21.3, x64)
  • Monaco - node (v18.10.0, x64)
  • Monaco - node (v16.17.1, x64)
  • Monaco - node (v14.21.3, x64)
  • TFS - node (v18.10.0, x64)
  • TFS - node (v16.17.1, x64)
  • TFS - node (v14.21.3, x64)
  • material-ui - node (v18.10.0, x64)
  • material-ui - node (v16.17.1, x64)
  • material-ui - node (v14.21.3, x64)
  • xstate - node (v18.10.0, x64)
  • xstate - node (v16.17.1, x64)
  • xstate - node (v14.21.3, x64)
Benchmark Name Iterations
Current 54596 6
Baseline main 6

TSServer

Comparison Report - main..54596
Metric main 54596 Delta Best Worst p-value
Compiler-UnionsTSServer - node (v18.10.0, x64)
Req 1 - updateOpen 2,541ms (± 0.39%) 2,536ms (± 0.19%) ~ 2,526ms 2,539ms p=0.195 n=6
Req 2 - geterr 5,545ms (± 0.72%) 5,529ms (± 0.40%) ~ 5,489ms 5,547ms p=0.229 n=6
Req 3 - references 336ms (± 0.93%) 338ms (± 0.82%) ~ 334ms 341ms p=0.333 n=6
Req 4 - navto 289ms (± 1.55%) 287ms (± 1.35%) ~ 284ms 295ms p=0.366 n=6
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) ~ 1,356 1,356 p=1.000 n=6
Req 5 - completionInfo 85ms (± 0.89%) 85ms (± 1.24%) ~ 83ms 86ms p=0.611 n=6
CompilerTSServer - node (v18.10.0, x64)
Req 1 - updateOpen 2,648ms (± 0.44%) 2,662ms (± 1.34%) ~ 2,643ms 2,734ms p=0.748 n=6
Req 2 - geterr 4,290ms (± 0.49%) 4,253ms (± 1.89%) ~ 4,091ms 4,299ms p=0.629 n=6
Req 3 - references 349ms (± 0.24%) 348ms (± 0.34%) ~ 346ms 349ms p=1.000 n=6
Req 4 - navto 286ms (± 0.26%) 288ms (± 0.57%) ~ 286ms 290ms p=0.112 n=6
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) ~ 1,518 1,518 p=1.000 n=6
Req 5 - completionInfo 65ms (± 5.83%) 69ms (±11.94%) ~ 61ms 84ms p=0.624 n=6
xstateTSServer - node (v18.10.0, x64)
Req 1 - updateOpen 3,102ms (± 0.59%) 3,086ms (± 0.34%) ~ 3,072ms 3,100ms p=0.128 n=6
Req 2 - geterr 1,564ms (± 1.05%) 1,572ms (± 0.82%) ~ 1,555ms 1,593ms p=0.423 n=6
Req 3 - references 114ms (± 1.16%) 113ms (± 1.04%) ~ 112ms 115ms p=0.125 n=6
Req 4 - navto 359ms (± 0.34%) 358ms (± 0.29%) ~ 356ms 359ms p=0.210 n=6
Req 5 - completionInfo count 2,864 (± 0.00%) 2,864 (± 0.00%) ~ 2,864 2,864 p=1.000 n=6
Req 5 - completionInfo 375ms (± 2.71%) 381ms (± 1.94%) ~ 366ms 387ms p=0.421 n=6
Compiler-UnionsTSServer - node (v16.17.1, x64)
Req 1 - updateOpen 2,676ms (± 0.45%) 2,666ms (± 0.76%) ~ 2,647ms 2,697ms p=0.378 n=6
Req 2 - geterr 6,041ms (± 0.50%) 6,007ms (± 0.36%) ~ 5,967ms 6,029ms p=0.173 n=6
Req 3 - references 351ms (± 0.75%) 351ms (± 0.64%) ~ 349ms 355ms p=0.935 n=6
Req 4 - navto 289ms (± 1.62%) 284ms (± 1.03%) ~ 280ms 288ms p=0.106 n=6
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) ~ 1,356 1,356 p=1.000 n=6
Req 5 - completionInfo 94ms (± 0.43%) 89ms (± 8.41%) 🟩-5ms (- 5.68%) 74ms 93ms p=0.006 n=6
CompilerTSServer - node (v16.17.1, x64)
Req 1 - updateOpen 2,830ms (± 0.35%) 2,830ms (± 0.51%) ~ 2,809ms 2,852ms p=0.936 n=6
Req 2 - geterr 4,667ms (± 0.34%) 4,654ms (± 0.33%) ~ 4,625ms 4,669ms p=0.378 n=6
Req 3 - references 364ms (± 0.25%) 364ms (± 0.64%) ~ 361ms 367ms p=0.807 n=6
Req 4 - navto 281ms (± 0.78%) 281ms (± 0.81%) ~ 279ms 285ms p=0.683 n=6
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) ~ 1,518 1,518 p=1.000 n=6
Req 5 - completionInfo 67ms (± 1.21%) 67ms (± 1.21%) ~ 66ms 68ms p=0.787 n=6
xstateTSServer - node (v16.17.1, x64)
Req 1 - updateOpen 3,218ms (± 0.45%) 3,213ms (± 0.25%) ~ 3,202ms 3,221ms p=0.573 n=6
Req 2 - geterr 1,743ms (± 0.80%) 1,745ms (± 0.85%) ~ 1,726ms 1,759ms p=0.936 n=6
Req 3 - references 126ms (± 7.54%) 121ms (± 1.10%) ~ 120ms 123ms p=0.195 n=6
Req 4 - navto 340ms (± 0.61%) 340ms (± 0.57%) ~ 337ms 342ms p=0.867 n=6
Req 5 - completionInfo count 2,864 (± 0.00%) 2,864 (± 0.00%) ~ 2,864 2,864 p=1.000 n=6
Req 5 - completionInfo 412ms (± 1.40%) 416ms (± 1.64%) ~ 408ms 425ms p=0.368 n=6
Compiler-UnionsTSServer - node (v14.21.3, x64)
Req 1 - updateOpen 2,793ms (± 0.44%) 2,786ms (± 0.40%) ~ 2,772ms 2,801ms p=0.377 n=6
Req 2 - geterr 6,192ms (± 0.53%) 6,175ms (± 0.58%) ~ 6,115ms 6,209ms p=0.520 n=6
Req 3 - references 362ms (± 0.79%) 363ms (± 0.47%) ~ 361ms 365ms p=0.558 n=6
Req 4 - navto 290ms (± 1.46%) 288ms (± 0.36%) ~ 286ms 289ms p=0.219 n=6
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) ~ 1,356 1,356 p=1.000 n=6
Req 5 - completionInfo 98ms (± 3.56%) 102ms (± 1.62%) ~ 100ms 103ms p=0.061 n=6
CompilerTSServer - node (v14.21.3, x64)
Req 1 - updateOpen 2,952ms (± 0.83%) 2,964ms (± 0.52%) ~ 2,946ms 2,986ms p=0.173 n=6
Req 2 - geterr 4,580ms (± 1.57%) 4,562ms (± 0.99%) ~ 4,504ms 4,618ms p=1.000 n=6
Req 3 - references 374ms (± 1.13%) 372ms (± 1.00%) ~ 367ms 377ms p=0.629 n=6
Req 4 - navto 297ms (± 0.25%) 298ms (± 0.46%) ~ 296ms 299ms p=0.740 n=6
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) ~ 1,518 1,518 p=1.000 n=6
Req 5 - completionInfo 77ms (± 4.52%) 77ms (± 2.51%) ~ 76ms 81ms p=0.616 n=6
xstateTSServer - node (v14.21.3, x64)
Req 1 - updateOpen 3,455ms (± 1.20%) 3,453ms (± 1.36%) ~ 3,390ms 3,510ms p=1.000 n=6
Req 2 - geterr 1,832ms (± 0.59%) 1,837ms (± 0.56%) ~ 1,821ms 1,844ms p=0.744 n=6
Req 3 - references 149ms (± 7.33%) 151ms (± 6.12%) ~ 133ms 158ms p=0.936 n=6
Req 4 - navto 400ms (± 1.08%) 403ms (± 0.76%) ~ 399ms 407ms p=0.257 n=6
Req 5 - completionInfo count 2,864 (± 0.00%) 2,864 (± 0.00%) ~ 2,864 2,864 p=1.000 n=6
Req 5 - completionInfo 430ms (± 3.70%) 429ms (± 2.86%) ~ 412ms 445ms p=0.810 n=6
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-148-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v18.10.0, x64)
  • node (v16.17.1, x64)
  • node (v14.21.3, x64)
Scenarios
  • Compiler-UnionsTSServer - node (v18.10.0, x64)
  • Compiler-UnionsTSServer - node (v16.17.1, x64)
  • Compiler-UnionsTSServer - node (v14.21.3, x64)
  • CompilerTSServer - node (v18.10.0, x64)
  • CompilerTSServer - node (v16.17.1, x64)
  • CompilerTSServer - node (v14.21.3, x64)
  • xstateTSServer - node (v18.10.0, x64)
  • xstateTSServer - node (v16.17.1, x64)
  • xstateTSServer - node (v14.21.3, x64)
Benchmark Name Iterations
Current 54596 6
Baseline main 6

Startup

Comparison Report - main..54596
Metric main 54596 Delta Best Worst p-value
tsc-startup - node (v16.17.1, x64)
Execution time 141.33ms (± 0.21%) 141.44ms (± 0.21%) +0.11ms (+ 0.08%) 140.62ms 144.54ms p=0.000 n=600
tsserver-startup - node (v16.17.1, x64)
Execution time 220.21ms (± 0.21%) 220.79ms (± 0.23%) +0.57ms (+ 0.26%) 219.28ms 225.59ms p=0.000 n=600
tsserverlibrary-startup - node (v16.17.1, x64)
Execution time 221.62ms (± 0.13%) 221.93ms (± 0.17%) +0.30ms (+ 0.14%) 220.73ms 225.98ms p=0.000 n=600
typescript-startup - node (v16.17.1, x64)
Execution time 203.52ms (± 0.20%) 203.70ms (± 0.18%) +0.18ms (+ 0.09%) 202.69ms 207.46ms p=0.000 n=600
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-148-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v16.17.1, x64)
Scenarios
  • tsc-startup - node (v16.17.1, x64)
  • tsserver-startup - node (v16.17.1, x64)
  • tsserverlibrary-startup - node (v16.17.1, x64)
  • typescript-startup - node (v16.17.1, x64)
Benchmark Name Iterations
Current 54596 6
Baseline main 6

Developer Information:

Download Benchmark

@typescript-bot
Copy link
Collaborator

@gabritto Here are the results of running the top-repos suite comparing main and refs/pull/54596/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

Hey @gabritto, the results of running the DT tests are ready.
Everything looks the same!
You can check the log here.

@gabritto gabritto requested review from weswigham and jakebailey June 12, 2023 18:15
@gabritto gabritto merged commit 03951f2 into main Jun 13, 2023
@gabritto gabritto deleted the gabritto/issue54498 branch June 13, 2023 16:57
@ImRodry
Copy link

ImRodry commented Jul 3, 2023

This didn't land in 5.1.6 right? When is it expected to be released?

@jakebailey
Copy link
Member

This is in the 5.2 beta (also noted in the issue's milestone).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

String constant fails to infer type inside nested unions
5 participants