-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbol
Milestone
Description
TypeScript Version: 3.9.2, 4.0 beta
Search Terms:
Convert to async function, refactor, quick fix
Code
import { identity } from "underscore"
function fetchZero() {
return Promise.resolve(0).then(identity);
}Expected behavior:
Running the "Convert to async function" Quick Fix on fetchZero should produce
async function fetchZero() {
const value=await Promise.resolve(0);
return identity(value);
}(or something similar). This is the behavior if identity is defined in the same file, with a first parameter named value.
Actual behavior:
Running the "Convert to async function" Quick Fix on fetchZero produces
async function fetchZero() {
const identity=await Promise.resolve(0);
return identity(identity);
}which produces a TypeError with identity(identity). This is the behavior if identity is imported.
Related Issues:
#39589 is another issue with the "Convert to async function" Quick Fix.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbol