mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
fix(47782): forbid super() extraction outside this container (#47784)
This commit is contained in:
@@ -486,8 +486,8 @@ namespace ts.refactor.extractSymbol {
|
||||
// but a super *method call* simply implies a 'this' reference
|
||||
if (node.parent.kind === SyntaxKind.CallExpression) {
|
||||
// Super constructor call
|
||||
const containingClass = getContainingClass(node)!; // TODO:GH#18217
|
||||
if (containingClass.pos < span.start || containingClass.end >= (span.start + span.length)) {
|
||||
const containingClass = getContainingClass(node);
|
||||
if (containingClass === undefined || containingClass.pos < span.start || containingClass.end >= (span.start + span.length)) {
|
||||
(errors ||= []).push(createDiagnosticForNode(node, Messages.cannotExtractSuper));
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user