Skip to content

Commit

Permalink
review update
Browse files Browse the repository at this point in the history
  • Loading branch information
Qiyu8 committed Aug 6, 2020
1 parent 5a68eb2 commit 85d5b4a
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/services/codefixes/fixImportNonExportedMember.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ namespace ts.codefix {
readonly importDecl: ImportDeclaration;
readonly originSourceFile: SourceFile
}
function isImportDeclaration(node: Node): node is ImportDeclaration {
return node.kind === SyntaxKind.ImportDeclaration;
}

function getInfo(sourceFile: SourceFile, context: CodeFixContext | CodeFixAllContext, pos: number): Info | undefined {
const node = getTokenAtPosition(sourceFile, pos);
Expand All @@ -49,9 +46,9 @@ namespace ts.codefix {

function getNamedExportDeclaration(sourceFile: SourceFile): ExportDeclaration | undefined {
let namedExport;
const statements = sourceFile.statements.filter(isExportDeclaration);
for (const statement of statements) {
if (statement.exportClause && isNamedExports(statement.exportClause)) {
for (const statement of sourceFile.statements) {
if (isExportDeclaration(statement) && statement.exportClause &&
isNamedExports(statement.exportClause)) {
namedExport = statement;
}
}
Expand All @@ -64,8 +61,7 @@ namespace ts.codefix {

function sortSpecifiers(specifiers: ExportSpecifier[]): readonly ExportSpecifier[] {
return stableSort(specifiers, (s1, s2) => {
return compareIdentifiers(s1.propertyName || s1.name, s2.propertyName || s2.name) ||
compareIdentifiers(s1.name, s2.name);
return compareIdentifiers(s1.propertyName || s1.name, s2.propertyName || s2.name);
});
}

Expand Down

0 comments on commit 85d5b4a

Please sign in to comment.