| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
TypeScript Bot (@typescript-bot) perf test |
Sorry, something went wrong.
|
Heya Ron Buckton (@rbuckton), I've started to run the parallelized Definitely Typed test suite on this PR at 46ce88c. You can monitor the build here. |
Sorry, something went wrong.
|
Heya Ron Buckton (@rbuckton), I've started to run the perf test suite on this PR at 46ce88c. You can monitor the build here. Update: The results are in! |
Sorry, something went wrong.
|
Heya Ron Buckton (@rbuckton), I've started to run the parallelized community code test suite on this PR at 46ce88c. You can monitor the build here. |
Sorry, something went wrong.
|
Heya Ron Buckton (@rbuckton), I've started to run the extended test suite on this PR at 46ce88c. You can monitor the build here. |
Sorry, something went wrong.
|
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
Sorry, something went wrong.
|
Interesting outcomes from the rwc tests:
|
Sorry, something went wrong.
|
Ron Buckton (@rbuckton) Comparison Report - main..45350
System
Hosts
Scenarios
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sorry, something went wrong.
|
The OOM in Prettier doesn't seem to be related to this change, as I'm seeing it in other unrelated PRs as well. |
Sorry, something went wrong.
|
Notes from design meeting:
|
Sorry, something went wrong.
|
I investigated whether having await return Awaited<T> would be a major breaking change in #45701 and it doesn't seem like that's the case, so I will merge the changes into this PR. |
Sorry, something went wrong.
|
TypeScript Bot (@typescript-bot) perf test |
Sorry, something went wrong.
|
Heya Ron Buckton (@rbuckton), I've started to run the extended test suite on this PR at 657f0a9. You can monitor the build here. |
Sorry, something went wrong.
|
Hey Andrew Branch (@andrewbranch), 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/110116/artifacts?artifactName=tgz&fileId=5F4D80343FB179768C7E7C97F73DA5C030AF4A59CDF0E108FC50B64AF7E7121F02&fileName=/typescript-4.5.0-insiders.20210909.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@4.5.0-pr-45350-27".; |
Sorry, something went wrong.
| T : // argument was not an object | ||
| T; // non-thenable |
There was a problem hiding this comment.
I believe that these comments are swapped.
Sorry, something went wrong.
There was a problem hiding this comment.
Apparently so. I will push up a small fix.
Sorry, something went wrong.
There was a problem hiding this comment.
Fixed by #45918
Sorry, something went wrong.
I did a quick search for Promise.all usages in the Google code base internally and only found a handful (~10) of usages with more than 1 generic parameter. We should be fine here. To check usages of await with generics we will have to actually upgrade TypeScript and see where the builds break, I think. We'll probably report that together with other findings. |
Sorry, something went wrong.
|
Hello everyone, Not sure if this is the correct place to bring this up but the Awaited<T> type as-is broke our build after upgrading from typescript 4.4.3 to 4.5.2. For reference, here is what Awaited<T> looks like: /**
* Recursively unwraps the "awaited type" of a type. Non-promise "thenables" should resolve to `never`. This emulates the behavior of `await`.
*/
type Awaited<T> =
T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode
T extends object & { then(onfulfilled: infer F): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped
F extends ((value: infer V) => any) ? // if the argument to `then` is callable, extracts the argument
Awaited<V> : // recursively unwrap the value
never : // the argument to `then` was not callable
T; // non-object or non-thenableThe problem is that we have a custom Promise class (AbortablePromise) and its then function accepts a onfulfilled callback that do not exactly match the condition F extends ((value: infer V) => any). Our then is declared like this: public then<TResult1 = T, TResult2 = never>(
onfulfilled?: ((value: T, abortController: AbortController) => TResult1 | PromiseLike<TResult1>) | undefined | null,
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null
): AbortablePromise<TResult1 | TResult2>;So onfulfilled in our case is (value: T, abortController: AbortController) => TResult1 | PromiseLike<TResult1>) which does not match (value: infer V) => any Hence, Awaited<T> where T is an AbortablePromise always returns never. Would it be possible to make the type condition more flexible in Awaited<T> to enable these promise extensions and still have the type be compatible with Promise.all, Promise.race, etc? |
Sorry, something went wrong.
|
It would be helpful to add some documentation about this on the Utility types page, not just in the 4.5 release notes that aren't part of the docs search. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This adds an Awaited<T> type alias that supports the following capabilities:
This also adds overloads to Promise.all, Promise.race, Promise.allSettled, and Promise.any to leverage Awaited<T>.
Supersedes #33707, thanks Jack Bates (@jablko) for your prior work on this.
Fixes #27711
Fixes #22469
Fixes #28427
Fixes #30390
Fixes #31722
Fixes #33559
Fixes #33562
Fixes #33752
Fixes #34924
Fixes #34937
Fixes #35136
Fixes #35258