mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 10:41:56 -05:00
Fix multi-file usage
1. Follow aliases with getSupers. 2. Make fix in file with superclass, not with the error.
This commit is contained in:
@@ -47,6 +47,7 @@ namespace ts.codefix {
|
||||
|
||||
startPosition = baseProp.valueDeclaration.pos;
|
||||
endPosition = baseProp.valueDeclaration.end;
|
||||
file = getSourceFileOfNode(baseProp.valueDeclaration);
|
||||
}
|
||||
else {
|
||||
Debug.fail("fixPropertyOverrideAccessor codefix got unexpected error code " + code);
|
||||
|
||||
@@ -229,8 +229,11 @@ namespace ts.codefix {
|
||||
while (decl) {
|
||||
const superElement = getClassExtendsHeritageElement(decl);
|
||||
const superSymbol = superElement && checker.getSymbolAtLocation(superElement.expression);
|
||||
const superDecl = superSymbol && find(superSymbol.declarations, isClassLike);
|
||||
if (superDecl) { res.push(superDecl); }
|
||||
if (!superSymbol) break;
|
||||
const symbol = superSymbol.flags & SymbolFlags.Alias ? checker.getAliasedSymbol(superSymbol) : superSymbol;
|
||||
const superDecl = find(symbol.declarations, isClassLike);
|
||||
if (!superDecl) break;
|
||||
res.push(superDecl);
|
||||
decl = superDecl;
|
||||
}
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user