TypeScript/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_NoRes2.ts
Ron Buckton 6f7f3b1775
Minor fixes to "Convert To Async" refactor (#45536)
* Minor fixes to convertToAsync

* Back out on nested return in inner continuation

* Baseline update

* Verify type argument for call can be used, add a few more early exit shortcuts
2021-09-01 13:13:12 -07:00

16 lines
393 B
TypeScript

// ==ORIGINAL==
function /*[#|*/f/*|]*/():Promise<void | Response> {
return fetch('https://typescriptlang.org').then(undefined).catch(rej => console.log(rej));
}
// ==ASYNC FUNCTION::Convert to async function==
async function f():Promise<void | Response> {
try {
return await fetch('https://typescriptlang.org');
} catch (rej) {
return console.log(rej);
}
}