mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 01:49:57 -05:00
Exclude JSDoc @extends from 'super()' checks (#29308)
* Exclude JSDoc @extends from 'super()' checks This fixes a similar problem as #29244 where JSDoc `@extends` * fix check 'super can only be referenced in a derived class'
This commit is contained in:
committed by
Nathan Shively-Sanders
parent
85e6c2f8ab
commit
b52a7fc3ea
@@ -16625,7 +16625,7 @@ namespace ts {
|
||||
|
||||
function checkThisBeforeSuper(node: Node, container: Node, diagnosticMessage: DiagnosticMessage) {
|
||||
const containingClassDecl = <ClassDeclaration>container.parent;
|
||||
const baseTypeNode = getEffectiveBaseTypeNode(containingClassDecl);
|
||||
const baseTypeNode = getClassExtendsHeritageElement(containingClassDecl);
|
||||
|
||||
// If a containing class does not have extends clause or the class extends null
|
||||
// skip checking whether super statement is called before "this" accessing.
|
||||
@@ -16974,7 +16974,7 @@ namespace ts {
|
||||
|
||||
// at this point the only legal case for parent is ClassLikeDeclaration
|
||||
const classLikeDeclaration = <ClassLikeDeclaration>container.parent;
|
||||
if (!getEffectiveBaseTypeNode(classLikeDeclaration)) {
|
||||
if (!getClassExtendsHeritageElement(classLikeDeclaration)) {
|
||||
error(node, Diagnostics.super_can_only_be_referenced_in_a_derived_class);
|
||||
return errorType;
|
||||
}
|
||||
@@ -23575,7 +23575,7 @@ namespace ts {
|
||||
// Constructors of classes with no extends clause may not contain super calls, whereas
|
||||
// constructors of derived classes must contain at least one super call somewhere in their function body.
|
||||
const containingClassDecl = <ClassDeclaration>node.parent;
|
||||
if (getEffectiveBaseTypeNode(containingClassDecl)) {
|
||||
if (getClassExtendsHeritageElement(containingClassDecl)) {
|
||||
captureLexicalThis(node.parent, containingClassDecl);
|
||||
const classExtendsNull = classDeclarationExtendsNull(containingClassDecl);
|
||||
const superCall = getSuperCallInConstructor(node);
|
||||
|
||||
Reference in New Issue
Block a user