mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 20:37:00 -05:00
Fix handling of default class
This commit is contained in:
@@ -1801,7 +1801,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function getAncestor(node: Node, kind: SyntaxKind): Node {
|
||||
export function getAncestor(node: Node | undefined, kind: SyntaxKind): Node {
|
||||
while (node) {
|
||||
if (node.kind === kind) {
|
||||
return node;
|
||||
|
||||
@@ -8,10 +8,11 @@ namespace ts.codefix {
|
||||
const token = getTokenAtPosition(sourceFile, start);
|
||||
const checker = context.program.getTypeChecker();
|
||||
|
||||
if (!(token.kind === SyntaxKind.Identifier && isClassLike(token.parent))) {
|
||||
const classDecl = getAncestor(token, SyntaxKind.ClassDeclaration) as ClassDeclaration;
|
||||
if (!(classDecl && isClassLike(classDecl))) {
|
||||
return undefined;
|
||||
}
|
||||
const classDecl = <ClassDeclaration>token.parent;
|
||||
|
||||
const startPos: number = classDecl.members.pos;
|
||||
|
||||
const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl);
|
||||
|
||||
Reference in New Issue
Block a user