镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

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

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