File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -21909,11 +21909,13 @@ namespace ts {
21909
21909
// check private/protected variable access
21910
21910
const parent = node.parent.parent;
21911
21911
const parentType = getTypeForBindingElementParent(parent);
21912
- const name = node.propertyName || <Identifier>node.name;
21913
- const property = getPropertyOfType(parentType, getTextOfPropertyName(name));
21914
- markPropertyAsReferenced(property, /*nodeForCheckWriteOnly*/ undefined, /*isThisAccess*/ false); // A destructuring is never a write-only reference.
21915
- if (parent.initializer && property) {
21916
- checkPropertyAccessibility(parent, parent.initializer, parentType, property);
21912
+ const name = node.propertyName || node.name;
21913
+ if (!isBindingPattern(name)) {
21914
+ const property = getPropertyOfType(parentType, getTextOfPropertyName(name));
21915
+ markPropertyAsReferenced(property, /*nodeForCheckWriteOnly*/ undefined, /*isThisAccess*/ false); // A destructuring is never a write-only reference.
21916
+ if (parent.initializer && property) {
21917
+ checkPropertyAccessibility(parent, parent.initializer, parentType, property);
21918
+ }
21917
21919
}
21918
21920
}
21919
21921
Original file line number Diff line number Diff line change @@ -570,17 +570,15 @@ namespace ts {
570
570
export function getTextOfPropertyName ( name : PropertyName ) : __String {
571
571
switch ( name . kind ) {
572
572
case SyntaxKind . Identifier :
573
- return ( < Identifier > name ) . escapedText ;
573
+ return name . escapedText ;
574
574
case SyntaxKind . StringLiteral :
575
575
case SyntaxKind . NumericLiteral :
576
- return escapeLeadingUnderscores ( ( < LiteralExpression > name ) . text ) ;
576
+ return escapeLeadingUnderscores ( name . text ) ;
577
577
case SyntaxKind . ComputedPropertyName :
578
- if ( isStringOrNumericLiteral ( ( < ComputedPropertyName > name ) . expression ) ) {
579
- return escapeLeadingUnderscores ( ( < LiteralExpression > ( < ComputedPropertyName > name ) . expression ) . text ) ;
580
- }
578
+ return isStringOrNumericLiteral ( name . expression ) ? escapeLeadingUnderscores ( name . expression . text ) : undefined ;
579
+ default :
580
+ Debug . assertNever ( name ) ;
581
581
}
582
-
583
- return undefined ;
584
582
}
585
583
586
584
export function entityNameToString ( name : EntityNameOrEntityNameExpression ) : string {
You can’t perform that action at this time.
0 commit comments