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

Weaken the definition of PromiseLike to allow 'T | awaited T' #37570

Closed
wants to merge 1 commit into from

Conversation

rbuckton
Copy link
Member

@rbuckton rbuckton commented Mar 25, 2020

This weakens the definition of PromiseLike to allow the value argument to be T | awaited T. This is necessary because PromiseLike represents any promise-like value that can be adopted by a native Promise. This includes Promise definitions that are not Promise/A+ compatible, such as JQuery's Deferred. As a result, the value argument may or not be recursively unwrapped depending on the implementation.

This is intended to work in conjunction with DefinitelyTyped/DefinitelyTyped#43337 to address errors in DefinitelyTyped and other projects following the introduction of awaited.

NOTE: this means that unlike with Promise, a PromiseLike<Promise<number>> will not be assignable to PromiseLike<number>, as the value may not be recursively unwrapped and therefore we cannot guarantee they are relatable.

@rbuckton
Copy link
Member Author

@typescript-bot perf test
@typescript-bot run dt
@typescript-bot test this
@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 25, 2020

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 25, 2020

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 25, 2020

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 25, 2020

Heya @rbuckton, I've started to run the parallelized community code test suite on this PR at ed49c32. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master.

@typescript-bot
Copy link
Collaborator

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

Here they are:

Comparison Report - master..37570

Metric master 37570 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 327,768k (± 0.03%) 327,148k (± 0.02%) -620k (- 0.19%) 326,998k 327,221k
Parse Time 1.64s (± 0.35%) 1.62s (± 0.62%) -0.02s (- 0.98%) 1.60s 1.64s
Bind Time 0.89s (± 0.54%) 0.89s (± 1.06%) +0.01s (+ 0.68%) 0.87s 0.91s
Check Time 4.75s (± 0.38%) 4.77s (± 0.45%) +0.02s (+ 0.38%) 4.71s 4.82s
Emit Time 5.33s (± 0.59%) 5.31s (± 0.65%) -0.03s (- 0.51%) 5.25s 5.39s
Total Time 12.61s (± 0.35%) 12.59s (± 0.46%) -0.02s (- 0.15%) 12.51s 12.75s
Monaco - node (v10.16.3, x64)
Memory used 327,114k (± 0.01%) 327,124k (± 0.01%) +10k (+ 0.00%) 327,039k 327,214k
Parse Time 1.26s (± 0.58%) 1.26s (± 0.39%) -0.00s (- 0.16%) 1.25s 1.27s
Bind Time 0.77s (± 0.29%) 0.77s (± 0.29%) 0.00s ( 0.00%) 0.77s 0.78s
Check Time 4.74s (± 0.32%) 4.71s (± 0.37%) -0.02s (- 0.46%) 4.67s 4.75s
Emit Time 2.94s (± 0.95%) 2.93s (± 0.83%) -0.01s (- 0.24%) 2.89s 2.99s
Total Time 9.71s (± 0.28%) 9.68s (± 0.24%) -0.03s (- 0.31%) 9.63s 9.72s
TFS - node (v10.16.3, x64)
Memory used 291,955k (± 0.02%) 291,946k (± 0.02%) -9k (- 0.00%) 291,823k 292,021k
Parse Time 0.95s (± 0.59%) 0.95s (± 0.71%) -0.00s (- 0.11%) 0.93s 0.96s
Bind Time 0.74s (± 0.83%) 0.74s (± 1.00%) +0.00s (+ 0.27%) 0.73s 0.76s
Check Time 4.27s (± 0.37%) 4.26s (± 0.38%) -0.01s (- 0.35%) 4.23s 4.30s
Emit Time 3.04s (± 0.84%) 3.04s (± 0.49%) +0.00s (+ 0.13%) 3.00s 3.08s
Total Time 9.00s (± 0.28%) 8.99s (± 0.23%) -0.01s (- 0.12%) 8.95s 9.04s
material-ui - node (v10.16.3, x64)
Memory used 452,923k (± 0.01%) 452,617k (± 0.01%) -306k (- 0.07%) 452,477k 452,697k
Parse Time 1.78s (± 0.47%) 1.77s (± 0.44%) -0.01s (- 0.67%) 1.75s 1.78s
Bind Time 0.68s (± 1.07%) 0.68s (± 0.77%) -0.00s (- 0.44%) 0.67s 0.69s
Check Time 13.73s (± 0.76%) 13.70s (± 0.62%) -0.03s (- 0.23%) 13.51s 13.86s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 16.19s (± 0.67%) 16.15s (± 0.52%) -0.04s (- 0.25%) 15.96s 16.30s
Angular - node (v12.1.0, x64)
Memory used 303,503k (± 0.03%) 302,988k (± 0.03%) -516k (- 0.17%) 302,813k 303,141k
Parse Time 1.57s (± 0.48%) 1.57s (± 0.43%) -0.01s (- 0.57%) 1.55s 1.58s
Bind Time 0.87s (± 0.89%) 0.86s (± 0.64%) -0.01s (- 1.03%) 0.85s 0.87s
Check Time 4.65s (± 0.36%) 4.64s (± 0.45%) -0.01s (- 0.28%) 4.59s 4.70s
Emit Time 5.46s (± 0.50%) 5.48s (± 0.93%) +0.02s (+ 0.27%) 5.38s 5.61s
Total Time 12.56s (± 0.29%) 12.55s (± 0.51%) -0.02s (- 0.12%) 12.39s 12.70s
Monaco - node (v12.1.0, x64)
Memory used 307,074k (± 0.02%) 307,064k (± 0.02%) -10k (- 0.00%) 306,931k 307,226k
Parse Time 1.21s (± 0.46%) 1.21s (± 0.51%) +0.00s (+ 0.25%) 1.20s 1.22s
Bind Time 0.74s (± 0.64%) 0.74s (± 1.08%) -0.00s (- 0.13%) 0.73s 0.76s
Check Time 4.55s (± 0.54%) 4.53s (± 0.42%) -0.02s (- 0.48%) 4.49s 4.57s
Emit Time 2.95s (± 0.53%) 2.94s (± 0.78%) -0.01s (- 0.41%) 2.90s 2.99s
Total Time 9.46s (± 0.33%) 9.43s (± 0.28%) -0.03s (- 0.34%) 9.38s 9.51s
TFS - node (v12.1.0, x64)
Memory used 274,242k (± 0.01%) 274,288k (± 0.02%) +46k (+ 0.02%) 274,171k 274,355k
Parse Time 0.93s (± 1.08%) 0.93s (± 0.93%) +0.00s (+ 0.11%) 0.91s 0.94s
Bind Time 0.71s (± 1.26%) 0.71s (± 1.16%) +0.00s (+ 0.14%) 0.69s 0.73s
Check Time 4.20s (± 0.56%) 4.18s (± 0.61%) -0.02s (- 0.45%) 4.12s 4.22s
Emit Time 3.10s (± 0.60%) 3.10s (± 0.87%) +0.01s (+ 0.26%) 3.04s 3.17s
Total Time 8.93s (± 0.41%) 8.93s (± 0.43%) -0.01s (- 0.07%) 8.80s 8.98s
material-ui - node (v12.1.0, x64)
Memory used 430,351k (± 0.02%) 430,104k (± 0.01%) -247k (- 0.06%) 429,976k 430,225k
Parse Time 1.75s (± 0.43%) 1.75s (± 0.51%) +0.00s (+ 0.06%) 1.73s 1.78s
Bind Time 0.63s (± 1.18%) 0.63s (± 0.95%) -0.00s (- 0.63%) 0.61s 0.64s
Check Time 12.17s (± 0.33%) 12.13s (± 0.46%) -0.04s (- 0.34%) 12.04s 12.30s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 14.55s (± 0.30%) 14.51s (± 0.41%) -0.04s (- 0.30%) 14.40s 14.68s
Angular - node (v8.9.0, x64)
Memory used 322,796k (± 0.01%) 322,342k (± 0.02%) -453k (- 0.14%) 322,201k 322,476k
Parse Time 2.12s (± 0.42%) 2.11s (± 0.56%) -0.00s (- 0.24%) 2.09s 2.14s
Bind Time 0.91s (± 0.89%) 0.92s (± 0.75%) +0.00s (+ 0.22%) 0.90s 0.93s
Check Time 5.48s (± 1.16%) 5.49s (± 1.03%) +0.01s (+ 0.22%) 5.29s 5.58s
Emit Time 6.24s (± 0.97%) 6.29s (± 0.96%) +0.06s (+ 0.95%) 6.21s 6.46s
Total Time 14.75s (± 0.38%) 14.81s (± 0.30%) +0.07s (+ 0.46%) 14.70s 14.91s
Monaco - node (v8.9.0, x64)
Memory used 325,466k (± 0.02%) 325,484k (± 0.01%) +18k (+ 0.01%) 325,407k 325,545k
Parse Time 1.54s (± 0.48%) 1.54s (± 0.45%) -0.00s (- 0.13%) 1.53s 1.56s
Bind Time 0.89s (± 0.65%) 0.89s (± 0.62%) -0.00s (- 0.11%) 0.88s 0.90s
Check Time 5.37s (± 0.81%) 5.38s (± 0.55%) +0.01s (+ 0.26%) 5.33s 5.46s
Emit Time 3.49s (± 0.55%) 3.51s (± 0.51%) +0.01s (+ 0.40%) 3.48s 3.55s
Total Time 11.30s (± 0.53%) 11.33s (± 0.29%) +0.03s (+ 0.22%) 11.27s 11.41s
TFS - node (v8.9.0, x64)
Memory used 291,404k (± 0.01%) 291,344k (± 0.02%) -60k (- 0.02%) 291,160k 291,489k
Parse Time 1.25s (± 0.36%) 1.25s (± 0.38%) -0.00s (- 0.16%) 1.24s 1.26s
Bind Time 0.74s (± 0.78%) 0.74s (± 0.90%) +0.00s (+ 0.00%) 0.73s 0.75s
Check Time 4.86s (± 0.55%) 4.92s (± 1.69%) +0.05s (+ 1.09%) 4.78s 5.09s
Emit Time 3.34s (± 1.38%) 3.26s (± 2.33%) -0.08s (- 2.49%) 3.08s 3.41s
Total Time 10.20s (± 0.35%) 10.17s (± 0.55%) -0.03s (- 0.33%) 10.07s 10.30s
material-ui - node (v8.9.0, x64)
Memory used 455,419k (± 0.01%) 455,209k (± 0.01%) -210k (- 0.05%) 455,026k 455,336k
Parse Time 2.11s (± 0.75%) 2.10s (± 0.32%) -0.01s (- 0.62%) 2.08s 2.11s
Bind Time 0.81s (± 1.22%) 0.81s (± 0.84%) -0.00s (- 0.25%) 0.79s 0.82s
Check Time 17.86s (± 0.55%) 17.71s (± 0.55%) -0.15s (- 0.85%) 17.46s 17.86s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 20.78s (± 0.48%) 20.61s (± 0.50%) -0.17s (- 0.80%) 20.35s 20.77s
Angular - node (v8.9.0, x86)
Memory used 185,731k (± 0.03%) 185,493k (± 0.02%) -238k (- 0.13%) 185,410k 185,591k
Parse Time 2.05s (± 0.61%) 2.05s (± 0.56%) -0.00s (- 0.10%) 2.03s 2.08s
Bind Time 1.07s (± 0.73%) 1.07s (± 0.62%) +0.00s (+ 0.37%) 1.06s 1.09s
Check Time 5.00s (± 0.27%) 5.02s (± 0.54%) +0.02s (+ 0.38%) 4.97s 5.09s
Emit Time 6.07s (± 0.83%) 6.06s (± 0.66%) -0.01s (- 0.16%) 5.99s 6.18s
Total Time 14.19s (± 0.30%) 14.20s (± 0.33%) +0.01s (+ 0.06%) 14.08s 14.28s
Monaco - node (v8.9.0, x86)
Memory used 185,281k (± 0.03%) 185,315k (± 0.03%) +34k (+ 0.02%) 185,172k 185,450k
Parse Time 1.59s (± 0.73%) 1.59s (± 1.40%) -0.00s (- 0.13%) 1.57s 1.68s
Bind Time 0.76s (± 0.62%) 0.77s (± 0.76%) +0.00s (+ 0.52%) 0.76s 0.78s
Check Time 5.39s (± 0.34%) 5.40s (± 0.31%) +0.02s (+ 0.33%) 5.37s 5.44s
Emit Time 2.88s (± 1.50%) 2.86s (± 0.85%) -0.02s (- 0.59%) 2.83s 2.94s
Total Time 10.63s (± 0.49%) 10.63s (± 0.38%) +0.01s (+ 0.06%) 10.55s 10.70s
TFS - node (v8.9.0, x86)
Memory used 166,796k (± 0.02%) 166,773k (± 0.02%) -23k (- 0.01%) 166,717k 166,825k
Parse Time 1.29s (± 0.60%) 1.29s (± 0.74%) -0.00s (- 0.23%) 1.27s 1.31s
Bind Time 0.71s (± 0.56%) 0.71s (± 0.67%) +0.00s (+ 0.56%) 0.70s 0.72s
Check Time 4.63s (± 0.80%) 4.63s (± 1.03%) +0.01s (+ 0.17%) 4.53s 4.73s
Emit Time 2.98s (± 0.65%) 2.99s (± 0.87%) +0.01s (+ 0.37%) 2.92s 3.05s
Total Time 9.61s (± 0.42%) 9.63s (± 0.66%) +0.02s (+ 0.21%) 9.53s 9.78s
material-ui - node (v8.9.0, x86)
Memory used 257,623k (± 0.02%) 257,479k (± 0.02%) -145k (- 0.06%) 257,400k 257,619k
Parse Time 2.18s (± 0.80%) 2.17s (± 0.41%) -0.00s (- 0.23%) 2.15s 2.19s
Bind Time 0.69s (± 1.26%) 0.68s (± 1.18%) -0.01s (- 1.45%) 0.66s 0.70s
Check Time 16.20s (± 0.39%) 16.28s (± 0.53%) +0.08s (+ 0.49%) 16.08s 16.42s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 19.07s (± 0.35%) 19.13s (± 0.48%) +0.06s (+ 0.34%) 18.91s 19.28s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-166-generic
Architecturex64
Available Memory16 GB
Available Memory1 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v8.9.0, x64)
  • node (v8.9.0, x86)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v8.9.0, x64)
  • Angular - node (v8.9.0, x86)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v8.9.0, x64)
  • Monaco - node (v8.9.0, x86)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v8.9.0, x64)
  • TFS - node (v8.9.0, x86)
  • material-ui - node (v10.16.3, x64)
  • material-ui - node (v12.1.0, x64)
  • material-ui - node (v8.9.0, x64)
  • material-ui - node (v8.9.0, x86)
Benchmark Name Iterations
Current 37570 10
Baseline master 10

@falsandtru
Copy link
Contributor

Can you explain some actual problems caused by the current correct definition? If you weaken the definition, I have to define my correct PromiseLike interface to strictly check the types.

@sandersn
Copy link
Member

The user tests look pretty bad with this change. But I don't know what they were like before. Have they been this broken since first merging awaited ?

@falsandtru
Copy link
Contributor

See also my first fix falsandtru/spica@c569afd

We need strictAwaitedTypes: false by default (probably even when strict flag is enabled for a while). And strictAwaitedTypes must always be disabled in the dependencies as the other stricter checking flags has been. Currently I can't use the latest nightly build because it can't compile @types/jquery.

@rbuckton
Copy link
Member Author

Closing in favor of #37610 while we continue to investigate the impact of awaited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants