Skip to content

Async / Await Refactoring - Arguments in promise handlers that are not function type #26375

Closed

Description

Search Terms:
Async, Await, Refactoring, Code Fix, Expression, Arguments

Code

function f() {
	return Promise.resolve().then(f ? (x => 1) : (y => 2));
}

Expected behavior:
A refactoring is not offered.

Actual behavior:
A refactoring is offered and the following code is generated:

async function f() {
	await Promise.resolve();
}

Activity

  1. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions