Skip to content

fixUnusedIdentifier may remove a used side-effect #23970

@ghost

Description

TypeScript Version: 2.9.0-dev.20180506

Code

{ const x = launchMissiles(); }

Expected behavior:

const x = removed, and missiles still launched.

Actual behavior:

Missiles unlaunched.

Unfortunately we have no way of knowing whether a function call does have side effects (#17181), so doing this in general might be annoying as users have to manually delete function calls with unused results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: Quick FixesEditor-provided fixes, often called code actions.Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.SuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions