Skip to content

Convert to async refactoring can introduce name collision with parameter  #28530

@mjbvz

Description

@mjbvz

TypeScript Version: typescript@3.2.0-dev.20181114

Repo
For the code.

async function foo<T>(x: T): Promise<T> {
    return x;
}

function bar<T>(x: T): Promise<T> {
    return foo(x).then(foo)
}
  1. Return convert to async on bar

bug
This results in:

async function foo<T>(x: T): Promise<T> {
    return x;
}

async function bar<T>(x: T): Promise<T> {
    const x = await foo(x);
    return foo(x);
}

With an error because the new const x in bar collides with the x parameter

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: LS: Refactoringse.g. extract to constant or function, rename symbolFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions