Skip to content

Commit 85d5b4a

Browse files
committed
review update
1 parent 5a68eb2 commit 85d5b4a

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/services/codefixes/fixImportNonExportedMember.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ namespace ts.codefix {
2727
readonly importDecl: ImportDeclaration;
2828
readonly originSourceFile: SourceFile
2929
}
30-
function isImportDeclaration(node: Node): node is ImportDeclaration {
31-
return node.kind === SyntaxKind.ImportDeclaration;
32-
}
3330

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

5047
function getNamedExportDeclaration(sourceFile: SourceFile): ExportDeclaration | undefined {
5148
let namedExport;
52-
const statements = sourceFile.statements.filter(isExportDeclaration);
53-
for (const statement of statements) {
54-
if (statement.exportClause && isNamedExports(statement.exportClause)) {
49+
for (const statement of sourceFile.statements) {
50+
if (isExportDeclaration(statement) && statement.exportClause &&
51+
isNamedExports(statement.exportClause)) {
5552
namedExport = statement;
5653
}
5754
}
@@ -64,8 +61,7 @@ namespace ts.codefix {
6461

6562
function sortSpecifiers(specifiers: ExportSpecifier[]): readonly ExportSpecifier[] {
6663
return stableSort(specifiers, (s1, s2) => {
67-
return compareIdentifiers(s1.propertyName || s1.name, s2.propertyName || s2.name) ||
68-
compareIdentifiers(s1.name, s2.name);
64+
return compareIdentifiers(s1.propertyName || s1.name, s2.propertyName || s2.name);
6965
});
7066
}
7167

0 commit comments

Comments
 (0)