Skip to content

Commit

Permalink
Always return a promise on functions that don't always have an explic…
Browse files Browse the repository at this point in the history
…it return and inlineHelpers is set
  • Loading branch information
rpetrich committed May 25, 2019
1 parent ce67368 commit eca3a59
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion async-to-promises.ts
Expand Up @@ -3417,7 +3417,11 @@ export default function({ types, template, traverse, transformFromAst, version }
const inlineHelpers = readConfigKey(this.opts, "inlineHelpers");
const canThrow = checkForErrorsAndRewriteReturns(bodyPath, this, inlineHelpers);
if (inlineHelpers && !pathsReturnOrThrowCurrentNodes(bodyPath).all) {
path.node.body.body.push(types.returnStatement());
if (inlineHelpers) {
path.node.body.body.push(types.returnStatement(types.callExpression(promiseResolve(), [])));
} else {
path.node.body.body.push(types.returnStatement());
}
}
if (canThrow) {
if (inlineHelpers) {
Expand Down
2 changes: 1 addition & 1 deletion tests/default argument pattern/inlined.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit eca3a59

Please sign in to comment.