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
20 lines
435 B
TypeScript
20 lines
435 B
TypeScript
// ==ORIGINAL==
|
|
|
|
function /*[#|*/f/*|]*/() {
|
|
return Promise.resolve().then(() => ({ x: 3 })).catch(() => ({ x: "a" })).then(({ x }) => !!x);
|
|
}
|
|
|
|
// ==ASYNC FUNCTION::Convert to async function==
|
|
|
|
async function f() {
|
|
let result: { x: number; } | { x: string; };
|
|
try {
|
|
await Promise.resolve();
|
|
result = ({ x: 3 });
|
|
} catch {
|
|
result = ({ x: "a" });
|
|
}
|
|
const { x } = result;
|
|
return !!x;
|
|
}
|