Skip to content

Do not get awaited type of AsyncGenerator TNext #59644

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 2 commits into from
Aug 16, 2024
Merged

Do not get awaited type of AsyncGenerator TNext #59644

merged 2 commits into from
Aug 16, 2024

Conversation

rbuckton
Copy link
Contributor

We are incorrectly calling getAwaitedType on the TNext type of an async generator, despite the fact that the spec does not perform an Await.

Our runtime emit looks to be correct, only checker appears to be wrong here.

Fixes #44808

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Aug 15, 2024
@jakebailey
Copy link
Member

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

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

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

Everything looks good!

@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
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,615k (± 0.89%) 193,006k (± 0.76%) ~ 192,296k 195,996k p=0.471 n=6
Parse Time 1.58s (± 0.52%) 1.57s (± 0.57%) ~ 1.56s 1.58s p=0.176 n=6
Bind Time 0.85s (± 1.21%) 0.85s (± 1.42%) ~ 0.84s 0.87s p=1.000 n=6
Check Time 11.35s (± 0.43%) 11.35s (± 0.48%) ~ 11.27s 11.43s p=0.936 n=6
Emit Time 3.23s (± 0.38%) 3.24s (± 0.61%) ~ 3.22s 3.26s p=0.300 n=6
Total Time 17.01s (± 0.20%) 17.02s (± 0.41%) ~ 16.92s 17.10s p=0.808 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,530k (± 0.00%) 1,222,501k (± 0.00%) ~ 1,222,429k 1,222,562k p=0.521 n=6
Parse Time 7.94s (± 0.47%) 7.93s (± 0.60%) ~ 7.89s 8.02s p=0.464 n=6
Bind Time 2.23s (± 0.74%) 2.23s (± 0.28%) ~ 2.22s 2.24s p=0.931 n=6
Check Time 36.32s (± 0.34%) 36.21s (± 0.27%) ~ 36.11s 36.34s p=0.128 n=6
Emit Time 17.81s (± 0.21%) 17.79s (± 0.16%) ~ 17.76s 17.83s p=0.375 n=6
Total Time 64.29s (± 0.23%) 64.16s (± 0.19%) ~ 64.07s 64.40s p=0.054 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,491,254 2,491,254 ~ ~ ~ p=1.000 n=6
Types 1,006,231 1,006,231 ~ ~ ~ p=1.000 n=6
Memory used 2,365,298k (± 0.00%) 2,365,257k (± 0.00%) ~ 2,365,219k 2,365,290k p=0.521 n=6
Parse Time 9.23s (± 0.32%) 9.24s (± 0.49%) ~ 9.19s 9.30s p=0.747 n=6
Bind Time 2.17s (± 0.38%) 2.18s (± 0.63%) ~ 2.15s 2.19s p=0.325 n=6
Check Time 74.70s (± 0.37%) 74.71s (± 0.28%) ~ 74.49s 74.97s p=0.936 n=6
Emit Time 0.28s (± 1.45%) 0.28s (± 2.26%) ~ 0.27s 0.29s p=0.673 n=6
Total Time 86.39s (± 0.33%) 86.42s (± 0.27%) ~ 86.14s 86.69s p=0.873 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,231,261 1,231,260 -1 (- 0.00%) ~ ~ p=0.001 n=6
Types 264,287 264,287 ~ ~ ~ p=1.000 n=6
Memory used 2,352,831k (± 0.04%) 2,471,231k (±11.75%) ~ 2,351,941k 3,064,592k p=0.936 n=6
Parse Time 5.01s (± 0.69%) 4.96s (± 1.25%) ~ 4.88s 5.05s p=0.173 n=6
Bind Time 1.89s (± 0.64%) 1.89s (± 0.73%) ~ 1.87s 1.90s p=0.300 n=6
Check Time 34.73s (± 0.15%) 34.71s (± 0.40%) ~ 34.51s 34.87s p=1.000 n=6
Emit Time 3.31s (± 1.30%) 3.31s (± 0.62%) ~ 3.28s 3.33s p=0.871 n=6
Total Time 44.95s (± 0.08%) 44.88s (± 0.37%) ~ 44.60s 45.08s p=0.378 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,231,261 1,231,260 -1 (- 0.00%) ~ ~ p=0.001 n=6
Types 264,287 264,287 ~ ~ ~ p=1.000 n=6
Memory used 2,426,580k (± 0.01%) 2,427,148k (± 0.02%) +568k (+ 0.02%) 2,426,695k 2,427,766k p=0.045 n=6
Parse Time 7.71s (± 0.56%) 7.72s (± 0.68%) ~ 7.68s 7.80s p=0.810 n=6
Bind Time 2.50s (± 0.94%) 2.51s (± 1.30%) ~ 2.47s 2.56s p=0.419 n=6
Check Time 51.63s (± 0.57%) 51.54s (± 0.26%) ~ 51.34s 51.69s p=0.936 n=6
Emit Time 5.05s (± 1.19%) 5.02s (± 0.82%) ~ 4.99s 5.09s p=0.377 n=6
Total Time 66.91s (± 0.49%) 66.83s (± 0.23%) ~ 66.64s 67.04s p=0.873 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 256,902 256,901 -1 (- 0.00%) ~ ~ p=0.001 n=6
Types 105,594 105,594 ~ ~ ~ p=1.000 n=6
Memory used 429,189k (± 0.01%) 429,295k (± 0.02%) +106k (+ 0.02%) 429,191k 429,378k p=0.031 n=6
Parse Time 2.79s (± 0.77%) 2.78s (± 0.27%) ~ 2.77s 2.79s p=0.805 n=6
Bind Time 1.09s (± 1.38%) 1.08s (± 1.36%) ~ 1.07s 1.10s p=0.203 n=6
Check Time 15.32s (± 0.31%) 15.36s (± 0.20%) ~ 15.31s 15.40s p=0.127 n=6
Emit Time 1.40s (± 1.16%) 1.39s (± 0.84%) ~ 1.38s 1.41s p=0.221 n=6
Total Time 20.61s (± 0.29%) 20.61s (± 0.19%) ~ 20.54s 20.65s p=0.871 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,153k (± 0.01%) 370,128k (± 0.02%) ~ 370,066k 370,240k p=0.229 n=6
Parse Time 2.29s (± 0.62%) 2.29s (± 0.58%) ~ 2.28s 2.31s p=0.802 n=6
Bind Time 1.33s (± 2.05%) 1.32s (± 1.24%) ~ 1.31s 1.35s p=0.178 n=6
Check Time 13.36s (± 0.30%) 13.32s (± 0.18%) ~ 13.29s 13.36s p=0.146 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 16.99s (± 0.26%) 16.93s (± 0.21%) ~ 16.89s 16.99s p=0.064 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 3,004,214 3,004,214 ~ ~ ~ p=1.000 n=6
Types 1,034,825 1,034,825 ~ ~ ~ p=1.000 n=6
Memory used 3,128,221k (± 0.00%) 3,128,160k (± 0.00%) ~ 3,128,077k 3,128,252k p=0.173 n=6
Parse Time 14.00s (± 0.40%) 13.96s (± 0.31%) ~ 13.90s 14.03s p=0.171 n=6
Bind Time 4.33s (± 2.18%) 4.29s (± 0.41%) ~ 4.26s 4.30s p=0.565 n=6
Check Time 79.79s (± 0.34%) 79.83s (± 0.29%) ~ 79.58s 80.15s p=0.689 n=6
Emit Time 20.54s (± 0.14%) 20.50s (± 0.28%) ~ 20.43s 20.60s p=0.172 n=6
Total Time 118.67s (± 0.26%) 118.58s (± 0.19%) ~ 118.23s 118.86s p=0.689 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,253k (± 0.02%) 424,234k (± 0.02%) ~ 424,166k 424,378k p=0.575 n=6
Parse Time 4.90s (± 0.15%) 4.91s (± 0.48%) ~ 4.88s 4.94s p=0.318 n=6
Bind Time 2.14s (± 1.01%) 2.12s (± 1.12%) ~ 2.09s 2.15s p=0.255 n=6
Check Time 21.60s (± 0.55%) 21.67s (± 0.22%) ~ 21.61s 21.75s p=0.297 n=6
Emit Time 0.00s (±244.70%) 0.00s ~ ~ ~ p=0.405 n=6
Total Time 28.64s (± 0.46%) 28.70s (± 0.20%) ~ 28.61s 28.79s p=0.375 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 534,188 534,188 ~ ~ ~ p=1.000 n=6
Types 176,207 176,207 ~ ~ ~ p=1.000 n=6
Memory used 479,265k (± 0.00%) 479,269k (± 0.01%) ~ 479,201k 479,306k p=0.748 n=6
Parse Time 3.39s (± 0.89%) 3.40s (± 0.45%) ~ 3.37s 3.41s p=0.805 n=6
Bind Time 1.24s (± 1.10%) 1.25s (± 0.94%) ~ 1.23s 1.26s p=0.563 n=6
Check Time 17.93s (± 0.24%) 17.93s (± 0.30%) ~ 17.87s 18.01s p=0.936 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 22.57s (± 0.20%) 22.58s (± 0.31%) ~ 22.49s 22.66s p=0.936 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/59644/merge:

Everything looks good!

@gabritto
Copy link
Member

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 15, 2024

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 15, 2024

Hey @gabritto, 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/163306/artifacts?artifactName=tgz&fileId=5A45468CEA7B378F428B4B3D354225573933893DA9D375F0DC45A2721566B93502&fileName=/typescript-5.6.0-insiders.20240815.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@5.6.0-pr-59644-8".;

Copy link
Member

@gabritto gabritto left a comment

Choose a reason for hiding this comment

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

Might be good to add a test case for when the async generator return type is inferred, but looks good to me.

@rbuckton rbuckton merged commit 09a8522 into main Aug 16, 2024
32 checks passed
@rbuckton rbuckton deleted the fix44808 branch August 16, 2024 15:55
@sandersn sandersn removed this from PR Backlog Apr 22, 2025
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.

AsyncGenerator doesn't play nicely with TNext = Promise<...>
4 participants