TypeScript/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen3.ts

18 lines
625 B
TypeScript

// ==ORIGINAL==
function /*[#|*/f/*|]*/() {
return Promise.resolve().then(() =>
Promise.all([fetch("https://typescriptlang.org"), fetch("https://microsoft.com"), Promise.resolve().then(function () {
return fetch("https://github.com");
}).then(res => res.toString())]));
}
// ==ASYNC FUNCTION::Convert to async function==
async function f() {
await Promise.resolve();
return await Promise.all([fetch("https://typescriptlang.org"), fetch("https://microsoft.com"), Promise.resolve().then(function() {
return fetch("https://github.com");
}).then(res => res.toString())]);
}