Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DanielRosenwasser opened this issue Mar 17, 2020 · 12 comments
Open

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

DanielRosenwasser opened this issue Mar 17, 2020 · 12 comments

Comments

@DanielRosenwasser
Copy link
Member

@DanielRosenwasser DanielRosenwasser commented Mar 17, 2020

In #36187, @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.

@AGMETEOR
Copy link
Contributor

@AGMETEOR AGMETEOR commented Mar 19, 2020

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

@DanielRosenwasser
Copy link
Member Author

@DanielRosenwasser DanielRosenwasser commented Mar 19, 2020

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
Copy link
Member Author

@DanielRosenwasser DanielRosenwasser commented Mar 19, 2020

Sorry, I meant fixForgottenThisPropertyAccess.ts!

@AGMETEOR
Copy link
Contributor

@AGMETEOR AGMETEOR commented Mar 19, 2020

Thanks a lot :)

@jjpiv
Copy link

@jjpiv jjpiv commented Apr 5, 2020

@AGMETEOR Are you still working on this issue? If not, I'm looking for an opportunity to begin contributing. :)

@AGMETEOR
Copy link
Contributor

@AGMETEOR AGMETEOR commented Apr 5, 2020

@jjpiv yes, I am working on it

@AGMETEOR
Copy link
Contributor

@AGMETEOR AGMETEOR commented Apr 8, 2020

@jjpiv please take this on if you still want to.

@davidstellini
Copy link

@davidstellini davidstellini commented Apr 9, 2020

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

@Qiyu8
Copy link

@Qiyu8 Qiyu8 commented Apr 14, 2020

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
Copy link
Contributor

@AGMETEOR AGMETEOR commented Apr 14, 2020

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

@Qiyu8
Copy link

@Qiyu8 Qiyu8 commented Apr 16, 2020

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

@AGMETEOR
Copy link
Contributor

@AGMETEOR AGMETEOR commented Apr 16, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.