mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
Wire up 'writing' parameter through protected derived class detection (#43455)
Fixes #43443
This commit is contained in:
@@ -19676,8 +19676,8 @@ namespace ts {
|
||||
|
||||
// Return true if the given class derives from each of the declaring classes of the protected
|
||||
// constituents of the given property.
|
||||
function isClassDerivedFromDeclaringClasses(checkClass: Type, prop: Symbol) {
|
||||
return forEachProperty(prop, p => getDeclarationModifierFlagsFromSymbol(p) & ModifierFlags.Protected ?
|
||||
function isClassDerivedFromDeclaringClasses(checkClass: Type, prop: Symbol, writing: boolean) {
|
||||
return forEachProperty(prop, p => getDeclarationModifierFlagsFromSymbol(p, writing) & ModifierFlags.Protected ?
|
||||
!hasBaseType(checkClass, getDeclaringClass(p)) : false) ? undefined : checkClass;
|
||||
}
|
||||
|
||||
@@ -26907,7 +26907,7 @@ namespace ts {
|
||||
// of the property as base classes
|
||||
let enclosingClass = forEachEnclosingClass(node, enclosingDeclaration => {
|
||||
const enclosingClass = <InterfaceType>getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)!);
|
||||
return isClassDerivedFromDeclaringClasses(enclosingClass, prop) ? enclosingClass : undefined;
|
||||
return isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing) ? enclosingClass : undefined;
|
||||
});
|
||||
// A protected property is accessible if the property is within the declaring class or classes derived from it
|
||||
if (!enclosingClass) {
|
||||
|
||||
Reference in New Issue
Block a user