Skip to content

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

@elizabethdinella

Description

@elizabethdinella

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();
}

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