Typescript: Provide a quick-fix for non-exported types

Created on 17 Mar 2020  路  12Comments  路  Source: microsoft/TypeScript

In https://github.com/microsoft/TypeScript/pull/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.

Quick Fixes Experience Enhancement Suggestion good first issue help wanted

All 12 comments

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

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.`
  }
}

Sorry, I meant fixForgottenThisPropertyAccess.ts!

Thanks a lot :)

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

@jjpiv yes, I am working on it

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

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

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";

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

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

weswigham picture weswigham  路  3Comments

wmaurer picture wmaurer  路  3Comments

seanzer picture seanzer  路  3Comments

MartynasZilinskas picture MartynasZilinskas  路  3Comments

dlaberge picture dlaberge  路  3Comments