Error on class fields accesses through super in JS files (#55892)

This commit is contained in:
Mateusz Burzyński
2023-09-29 12:29:39 -07:00
committed by GitHub
parent 9cf44dc51a
commit 485a2ea0c9
16 changed files with 638 additions and 1 deletions
+8 -1
View File
@@ -102,7 +102,9 @@ import {
isArrowFunction,
isAssignmentExpression,
isBinaryExpression,
isBindableStaticAccessExpression,
isBindableStaticElementAccessExpression,
isBindableStaticNameExpression,
isBindingElement,
isBlock,
isCallExpression,
@@ -111,6 +113,7 @@ import {
isClassStaticBlockDeclaration,
isDecorator,
isElementAccessExpression,
isExpandoPropertyDeclaration,
isExportAssignment,
isExportDeclaration,
isExportSpecifier,
@@ -153,6 +156,7 @@ import {
isPropertyAccessExpression,
isPropertyAssignment,
isPropertyDeclaration,
isPrototypeAccess,
isRootedDiskPath,
isSourceFile,
isStringLiteral,
@@ -1705,7 +1709,10 @@ export function isAutoAccessorPropertyDeclaration(node: Node): node is AutoAcces
}
/** @internal */
export function isClassFieldAndNotAutoAccessor(node: Node): boolean {
export function isClassFieldAndNotAutoAccessor(node: Declaration): boolean {
if (isInJSFile(node) && isExpandoPropertyDeclaration(node)) {
return (!isBindableStaticAccessExpression(node) || !isPrototypeAccess(node.expression)) && !isBindableStaticNameExpression(node, /*excludeThisKeyword*/ true);
}
return node.parent && isClassLike(node.parent) && isPropertyDeclaration(node) && !hasAccessorModifier(node);
}