Skip to content

Conversation

uniqueiniquity
Copy link
Contributor

Fixes #26374
This PR aims to fix a few issues:

  • Currently, we look to report suggestion diagnostics for the async code fix by checking the signatures of the return type annotation of a FunctionLikeDeclaration. Here, we change it to inspect the signatures of the entire declaration.
  • By doing the above by using the checker in suggestionDiagnostics.ts, we caused undesirable checking behavior in a subsequent full-source-file check. Therefore, this change moves suggestion diagnostic reporting for the async code fix into the checker walk itself and documents a distinction between syntactic and semantic suggestion diagnostic reporting.
  • Currently, if a FunctionExpression that is fixable is the direct child of a VariableDeclaration, then it reports a diagnostic on the variable name. However, triggering the code fix on the variable name will not successfully perform the change. This PR specifically handles this scenario when performing the code fix.
  • We also add test coverage for FunctionExpressions, as well as FunctionLikeDeclarations without a return type annotation.
  • Lastly, we now validate spans that are reported as suggestion diagnostics against what is expected by the test.

Copy link
Member

@RyanCavanaugh RyanCavanaugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking my current review status for bookkeeping purposes based on our conversation yesterday

@uniqueiniquity
Copy link
Contributor Author

There's a much simpler fix. Closing and starting again.

@uniqueiniquity uniqueiniquity deleted the cleanUpAsyncRefactoring branch August 29, 2018 23:07
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Async / Await Refactoring - Not offered on promise returning functions without an explicit return type

2 participants