Skip to content

[BUG] Spreads are improperly sorted #24

@jesuscc1993

Description

@jesuscc1993

Description

Sorting an object with spreads results in fields in the wrong order, altering the result.

Given these objects:

const objA = {
  h: 1080,
  w: 1600
}

const objB = {
  ...objA,
  w: 1920
}

sorting objB with the extension results in

const objB = {
  w: 1920,
  ...objA
}

which is incorrect, as the new fields are no longer overwriting those in the spread object.

Expected result

const objB = {
  ...objA,
  w: 1920
}

objB === { h: 1080, w: 1920 }

Actual result

const objB = {
  w: 1920,
  ...objA
}

objB === { h: 1080, w: 1600 }

Environment

macOS Big Sur 11.6 (20G165)
VSC 1.62.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions