6f7f3b1775
* 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
16 lines
432 B
TypeScript
16 lines
432 B
TypeScript
// ==ORIGINAL==
|
|
|
|
function /*[#|*/f/*|]*/():Promise<void | Response> {
|
|
return fetch('https://typescriptlang.org').then(null, rejection => console.log("rejected:", rejection));
|
|
}
|
|
|
|
// ==ASYNC FUNCTION::Convert to async function==
|
|
|
|
async function f():Promise<void | Response> {
|
|
try {
|
|
return await fetch('https://typescriptlang.org');
|
|
} catch (rejection) {
|
|
return console.log("rejected:", rejection);
|
|
}
|
|
}
|