Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

codefix: Remove declaration for local in destructuring assignment breaks code. #22330

Copy link
Copy link
@NaridaL

Description

@NaridaL
Issue body actions

TypeScript Version: 2.8.0-dev.20180302

Search Terms: "remove declaration for" remove declaration destructuring

Code

--noUnusedLocals needs to be on.
The "remove declaration for" quick fix for unused locals is broken:

function f() {
	const {abs, floor, ceil} = Math
	const {sin, cos, tan} = Math
}

Expected behavior:
After code fix on abs:

function f() {
	const {floor, ceil} = Math
	const {sin, cos, tan} = Math
}

After code fix "fix all":

function f() {
}

Possible side effects of the RHS are ignored by the const abs = Math.abs quick fix, so this should be mirrored here.
Actual behavior:

function f() {
	const {, floor, ceil} = Math
	const {sin, cos, tan} = Math
}

After code fix "fix all":

function f() {
	const {,,} = Math
	const {,,} = Math
}

screencast: https://gfycat.com/SleepyEnchantingArcticfox

Related Issues:

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueGood First IssueWell scoped, documented and has the green lightWell scoped, documented and has the green lightHelp WantedYou can do thisYou can do this

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.