Skip to content

noUnusedLocals doesn't error when using a ...rest declaration #61748

Closed as not planned
@scamden

Description

@scamden

πŸ”Ž Search Terms

desctructure noUnusedLocals rest

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about noUnusedLocals

⏯ Playground Link

https://www.typescriptlang.org/play/?noUncheckedIndexedAccess=true&noUnusedLocals=true&noUnusedParameters=true&target=99#code/GYVwdgxgLglg9mABAWznAFASkQbwFCKGIQIDOUiAhogLy7UBciAjADSIBGiTATAL4EiJMOVyd2AOikAnAKai+tKgG5BhNcTIUIS5qoFA

πŸ’» Code

function moo() {
    const A = {a : 1, b : 2}
    // no error on b
    const { b, ...rest } = A;
    // error on a as expected
    const { a } = A
    const c = 1;
}

πŸ™ Actual behavior

no error on an unused local

πŸ™‚ Expected behavior

error on any unused local whether a ...rest param is used or not

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions