Skip to content

v1.0.9

Choose a tag to compare

@github-actions github-actions released this 08 Feb 21:39
· 19 commits to main since this release
66e92a7

Patch Changes

  • d255b12: Preserve unused variables in object patterns when rest element is used.
    That way, it remains filtered out of the rest element.

    For example:

    let { a, ...rest } = { a: 1, b: 2, c: 3 }
    //    ^ `a` is unused
    
    console.log(rest)
    // { b: 2, c: 3 }

    Eliminating a would incorrectly change runtime behavior:

    let { ...rest } = { a: 1, b: 2, c: 3 }
    
    console.log(rest)
    // { a: 1, b: 2, c: 3 }
    //   ^^^^^ this shouldn't be here...

    So it is preserved as-is instead.