Skip to content

Extract-method with namespace declaration results in invalid code #18546

Closed
@ghost

Description

TypeScript Version: nightly (2.6.0-dev.20170916)

See test extract-method-empty-namespace.ts.

Code

function f() {
    namespace N {}
}

Extract "namespace N" out to a global function.

Expected behavior:

function f() {
    newFunction();
}
function newFunction() {
    namespace N { }
}

Actual behavior:

function f() {
    newFunction(N);
}
function newFunction(N: any) {
    namespace N { }
}

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Refactoringse.g. extract to constant or function, rename symbol

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions