Sitelet https://github.com/microsoft/TypeScript/issues/37440
Skip to content

Provide a quick-fix for non-exported types #37440

Description

In #36187, Oleksandr Tarasiuk (@a-tarasyuk) wrote up a handy error message for non-exported types. We should provide a quick fix to add the export modifier for declarations like this that aren't in node_modules and the like.

Activity

AGMETEOR commented on Mar 19, 2020

@AGMETEOR
Contributor

Daniel Rosenwasser (@DanielRosenwasser) / Ryan Cavanaugh (@RyanCavanaugh) I can get time and work on this. Quick question, which files generally have the code for Domain "Quick Fixes"?

DanielRosenwasser commented on Mar 19, 2020

@DanielRosenwasser
MemberAuthor

It's all in src/services/codefixes/. Make sure you update src/services/tsconfig.json to include the new file for the quick fix. One similar code action would be in fixImplicitThis.ts which adds a this. to foo in

class C {
  foo = 10;
  bar() {
    foo; // oops! needs to be prefixed with `this.`
  }
}

DanielRosenwasser commented on Mar 19, 2020

@DanielRosenwasser
MemberAuthor

Sorry, I meant fixForgottenThisPropertyAccess.ts!

AGMETEOR commented on Mar 19, 2020

@AGMETEOR
Contributor

Thanks a lot :)

AGMETEOR commented on Apr 5, 2020

@AGMETEOR
Contributor

JJPIV yes, I am working on it

AGMETEOR commented on Apr 8, 2020

@AGMETEOR
Contributor

JJPIV please take this on if you still want to.

davidstellini commented on Apr 9, 2020

@davidstellini

JJPIV Did you take this? If not I'd like to take a shot :)

Qiyu8 commented on Apr 14, 2020

@Qiyu8

I'm working on this issue, currently stuck at getting SourceFile object for a.ts, can anybody help me?

// @filename a.ts

declare function foo(): any

declare function bar(): any;

export { bar };

// @filename b.ts

import { foo, bar } from "./a";

AGMETEOR commented on Apr 14, 2020

@AGMETEOR
Contributor

Chunlin (@Qiyu8) I think that information is in the context that's passed to getCodeActions(context: CodeFixContext) in the arg object for registerCodeFix

Qiyu8 commented on Apr 16, 2020

@Qiyu8

AGMETEOR Thanks for your advise, would you mind reviewing the code?

AGMETEOR commented on Apr 16, 2020

@AGMETEOR
Contributor

Chunlin (@Qiyu8) I think Daniel Rosenwasser (@DanielRosenwasser) is the one that reviews. I am also still quite a new contributor :)

BenjaVR commented on May 15, 2021

@BenjaVR

I assume nobody is working on this at the moment? If so, I would like to take a shot Daniel Rosenwasser (@DanielRosenwasser)

DanielRosenwasser commented on Oct 13, 2022

@DanielRosenwasser
MemberAuthor
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

    Domain: LS: Quick FixesEditor-provided fixes, often called code actions.Experience EnhancementNoncontroversial enhancementsFixedA PR has been merged for this issueGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do thisSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions