Skip to content

Object destructuring broken: variables are bound to the wrong object #9363

Closed
@shovon

Description

@shovon

TypeScript Version: 1.8.10

Code

interface ISomething {
    foo: string,
    bar: string
}

function foo({}, {foo, bar}: ISomething) {

}

Expected behavior:

function foo(_a, _b) {
    var foo = _b.foo, bar = _b.bar;
}

Actual behavior:

function foo(_a, _b) {
    var foo = _a.foo, bar = _a.bar;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions