Skip to content

in async code fix, handle promise handler callbacks that return a promise #27112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
uniqueiniquity opened this issue Sep 15, 2018 · 0 comments · Fixed by #27156
Closed

in async code fix, handle promise handler callbacks that return a promise #27112

uniqueiniquity opened this issue Sep 15, 2018 · 0 comments · Fixed by #27156
Assignees

Comments

@uniqueiniquity
Copy link
Contributor

TypeScript Version: 3.1.0-dev.201xxxxx

Search Terms:
async, promise, code fix, code action, then

Code

function foo() {
    return Promise.resolve().then(_ => Promise.resolve(4 + 5)).then(y => y + 5);
}

Expected behavior:
Async code fix produces

async function foo() {
    await Promise.resolve();
    const y = await Promise.resolve(4 + 5);
    return y + 5;
}

Actual behavior:
Async code fix produces

async function foo() {
    await Promise.resolve();
    const y = Promise.resolve(4 + 5);
    return y + 5;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant