Skip to content
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

make exported destructured discriminated union narrowing work #59673

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

MichalMarsalek
Copy link

@MichalMarsalek MichalMarsalek commented Aug 18, 2024

Please verify that:

  • There is an associated issue in the Backlog milestone (required)
  • Code is up-to-date with the main branch
  • You've successfully run hereby runtests locally
  • There are new or updated unit tests validating the change

Fixes #59652

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Aug 18, 2024
@MichalMarsalek MichalMarsalek changed the title make destructured discriminated union narrowing work make exported destructured discriminated union narrowing work Aug 18, 2024
@MichalMarsalek MichalMarsalek marked this pull request as ready for review August 19, 2024 05:43
@jakebailey
Copy link
Member

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 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.

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

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 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,153 62,153 ~ ~ ~ p=1.000 n=6
Types 50,242 50,242 ~ ~ ~ p=1.000 n=6
Memory used 193,530k (± 0.94%) 194,100k (± 0.97%) ~ 192,320k 195,859k p=0.470 n=6
Parse Time 1.31s (± 0.80%) 1.30s (± 1.23%) ~ 1.27s 1.31s p=0.615 n=6
Bind Time 0.71s 0.71s ~ ~ ~ p=1.000 n=6
Check Time 9.55s (± 0.17%) 9.55s (± 0.29%) ~ 9.51s 9.58s p=0.871 n=6
Emit Time 2.71s (± 2.08%) 2.69s (± 1.64%) ~ 2.63s 2.73s p=0.293 n=6
Total Time 14.28s (± 0.34%) 14.24s (± 0.33%) ~ 14.16s 14.29s p=0.229 n=6
angular-1 - node (v18.15.0, x64)
Errors 7 7 ~ ~ ~ p=1.000 n=6
Symbols 945,757 945,757 ~ ~ ~ p=1.000 n=6
Types 410,067 410,067 ~ ~ ~ p=1.000 n=6
Memory used 1,222,645k (± 0.00%) 1,222,605k (± 0.00%) ~ 1,222,543k 1,222,669k p=0.298 n=6
Parse Time 6.64s (± 0.32%) 6.67s (± 0.36%) ~ 6.64s 6.71s p=0.104 n=6
Bind Time 1.86s (± 0.22%) 1.86s (± 0.34%) ~ 1.85s 1.87s p=0.673 n=6
Check Time 31.10s (± 0.40%) 31.01s (± 0.26%) ~ 30.93s 31.11s p=0.148 n=6
Emit Time 14.98s (± 0.44%) 14.98s (± 0.44%) ~ 14.86s 15.03s p=1.000 n=6
Total Time 54.59s (± 0.21%) 54.51s (± 0.24%) ~ 54.29s 54.64s p=0.334 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,505,734 2,505,734 ~ ~ ~ p=1.000 n=6
Types 993,039 993,039 ~ ~ ~ p=1.000 n=6
Memory used 2,376,619k (± 0.00%) 2,376,738k (± 0.00%) ~ 2,376,594k 2,376,860k p=0.065 n=6
Parse Time 9.28s (± 0.21%) 9.30s (± 0.35%) ~ 9.26s 9.34s p=0.296 n=6
Bind Time 2.18s (± 0.34%) 2.19s (± 0.73%) ~ 2.16s 2.20s p=0.247 n=6
Check Time 73.96s (± 0.60%) 74.36s (± 1.52%) ~ 73.57s 76.47s p=0.689 n=6
Emit Time 0.28s (± 2.70%) 0.28s (± 3.49%) ~ 0.27s 0.29s p=0.554 n=6
Total Time 85.70s (± 0.54%) 86.13s (± 1.32%) ~ 85.36s 88.24s p=0.575 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,231,749 1,231,749 ~ ~ ~ p=1.000 n=6
Types 264,525 264,525 ~ ~ ~ p=1.000 n=6
Memory used 2,412,411k (± 6.01%) 2,353,211k (± 0.02%) ~ 2,352,546k 2,353,563k p=0.936 n=6
Parse Time 5.00s (± 0.73%) 4.97s (± 1.23%) ~ 4.89s 5.06s p=0.575 n=6
Bind Time 1.89s (± 1.00%) 1.88s (± 0.80%) ~ 1.87s 1.90s p=0.451 n=6
Check Time 34.66s (± 0.73%) 34.78s (± 0.11%) ~ 34.71s 34.82s p=0.078 n=6
Emit Time 3.35s (± 1.27%) 3.35s (± 0.96%) ~ 3.30s 3.38s p=0.936 n=6
Total Time 44.91s (± 0.65%) 45.00s (± 0.20%) ~ 44.87s 45.12s 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,231,749 1,231,749 ~ ~ ~ p=1.000 n=6
Types 264,525 264,525 ~ ~ ~ p=1.000 n=6
Memory used 2,428,110k (± 0.06%) 2,427,188k (± 0.03%) ~ 2,426,682k 2,427,994k p=0.128 n=6
Parse Time 6.17s (± 1.44%) 6.21s (± 0.48%) ~ 6.17s 6.26s p=0.810 n=6
Bind Time 2.02s (± 1.15%) 2.01s (± 0.63%) ~ 2.00s 2.03s p=0.514 n=6
Check Time 41.55s (± 0.69%) 41.43s (± 0.60%) ~ 41.20s 41.76s p=0.261 n=6
Emit Time 4.17s (± 5.44%) 4.22s (± 4.38%) ~ 4.05s 4.49s p=0.470 n=6
Total Time 53.93s (± 0.59%) 53.87s (± 0.39%) ~ 53.47s 54.10s p=0.378 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 256,947 256,947 ~ ~ ~ p=1.000 n=6
Types 105,643 105,643 ~ ~ ~ p=1.000 n=6
Memory used 429,455k (± 0.01%) 429,430k (± 0.01%) ~ 429,400k 429,478k p=0.298 n=6
Parse Time 4.16s (± 0.52%) 4.15s (± 0.50%) ~ 4.12s 4.17s p=0.746 n=6
Bind Time 1.60s (± 1.55%) 1.60s (± 0.65%) ~ 1.58s 1.61s p=0.935 n=6
Check Time 22.36s (± 0.32%) 22.36s (± 0.52%) ~ 22.25s 22.56s p=0.688 n=6
Emit Time 2.06s (± 1.21%) 2.05s (± 1.05%) ~ 2.02s 2.08s p=0.808 n=6
Total Time 30.18s (± 0.34%) 30.17s (± 0.39%) ~ 30.06s 30.38s p=0.423 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 225,018 225,018 ~ ~ ~ p=1.000 n=6
Types 94,245 94,245 ~ ~ ~ p=1.000 n=6
Memory used 370,080k (± 0.01%) 370,143k (± 0.04%) ~ 369,993k 370,394k p=0.378 n=6
Parse Time 2.75s (± 1.21%) 2.77s (± 1.03%) ~ 2.73s 2.81s p=0.413 n=6
Bind Time 1.57s (± 0.52%) 1.56s (± 0.66%) ~ 1.55s 1.58s p=0.546 n=6
Check Time 15.71s (± 0.22%) 15.69s (± 0.32%) ~ 15.64s 15.75s p=0.285 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 20.02s (± 0.30%) 20.02s (± 0.25%) ~ 19.97s 20.10s p=0.630 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 3,006,672 3,006,672 ~ ~ ~ p=1.000 n=6
Types 1,035,540 1,035,540 ~ ~ ~ p=1.000 n=6
Memory used 3,130,176k (± 0.00%) 3,130,228k (± 0.00%) ~ 3,130,103k 3,130,349k p=0.423 n=6
Parse Time 17.21s (± 0.23%) 17.18s (± 0.35%) ~ 17.09s 17.26s p=0.469 n=6
Bind Time 5.23s (± 0.23%) 5.23s (± 0.26%) ~ 5.21s 5.25s p=0.410 n=6
Check Time 96.78s (± 0.41%) 96.69s (± 0.43%) ~ 96.28s 97.34s p=0.810 n=6
Emit Time 25.04s (± 0.98%) 24.97s (± 0.51%) ~ 24.83s 25.12s p=0.575 n=6
Total Time 144.27s (± 0.35%) 144.07s (± 0.29%) ~ 143.43s 144.62s p=0.575 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 275,352 275,352 ~ ~ ~ p=1.000 n=6
Types 112,436 112,436 ~ ~ ~ p=1.000 n=6
Memory used 424,141k (± 0.01%) 424,090k (± 0.02%) ~ 423,961k 424,233k p=0.298 n=6
Parse Time 3.98s (± 0.39%) 3.98s (± 0.58%) ~ 3.95s 4.02s p=0.803 n=6
Bind Time 1.74s (± 0.60%) 1.71s (± 0.71%) -0.02s (- 1.25%) 1.70s 1.73s p=0.018 n=6
Check Time 17.43s (± 0.52%) 17.41s (± 0.75%) ~ 17.24s 17.60s p=0.574 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 23.14s (± 0.42%) 23.11s (± 0.53%) ~ 22.93s 23.25s p=0.470 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 534,239 534,239 ~ ~ ~ p=1.000 n=6
Types 176,225 176,225 ~ ~ ~ p=1.000 n=6
Memory used 479,376k (± 0.01%) 479,349k (± 0.01%) ~ 479,310k 479,411k p=0.298 n=6
Parse Time 3.41s (± 0.86%) 3.41s (± 0.43%) ~ 3.39s 3.43s p=0.872 n=6
Bind Time 1.25s (± 0.88%) 1.26s (± 0.50%) ~ 1.25s 1.27s p=0.126 n=6
Check Time 18.00s (± 0.31%) 17.98s (± 0.33%) ~ 17.90s 18.04s p=0.810 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 22.66s (± 0.28%) 22.64s (± 0.28%) ~ 22.55s 22.72s p=1.000 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/59673/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
None yet
Development

Successfully merging this pull request may close these issues.

Variables (extracted from a discriminated union object) lose narrowed types after being exported
4 participants