Skip to content

codeFixes for things that aren't diagnostics #19392

Closed

Description

TypeScript Version: 2.7.0-dev.20171020

Code

function f(x) {}

It would be nice to have a codeFix to fix implicit-any instead of a refactoring. I believe a refactoring requires you to highlight the thing in question, which isn't easily discoverable.
Currently codeFixes work by iterating over errors; but in this case we would want to produce one even in an error-less build.
This would also help us avoid having to create codeFix / refactor pairs for things such as installing types for implicit-any packages.
We could also generate "info" errors (ref: #14501) that don't surface normally and make codeFixes for those.

CC Matt Bierner (@mjbvz)

Activity

  1. ghost added
    SuggestionAn idea for TypeScript
    on Oct 20, 2017
  2. DanielRosenwasser commented on Oct 20, 2017

    @DanielRosenwasser
    Member

    Andrew Casey (@amcasey) was talking about how this is enabled with "info" diagnostics in Roslyn

  3. amcasey commented on Oct 20, 2017

    @amcasey
    Member

    I asked about this at today's design meeting and the consensus seemed to be that we should create a separate (linter-like) tool to detect such cases and then offer to fix them (i.e. that this doesn't belong in the compiler).

  4. amcasey commented on Oct 20, 2017

    @amcasey
    Member

    I understood that we proposed to add new compiler APIs (e.g. getImplicitAnyDeclarations) on a case-by-case basis as we determined that doing the work in a separate tool was infeasible. I believe it was Mohamed Hegazy (@mhegazy) who brought it up.

  5. ghost closed this as completedin #22204on Feb 28, 2018
  6. locked and limited conversation to collaborators on Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedA PR has been merged for this issueSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions