11import {
2+ AccessorDeclaration ,
23 addRange ,
34 arrayFrom ,
45 BinaryExpression ,
@@ -16,7 +17,6 @@ import {
1617 first ,
1718 firstDefined ,
1819 forEach ,
19- GetAccessorDeclaration ,
2020 getCombinedLocalAndExportSymbolFlags ,
2121 getDeclarationOfKind ,
2222 getExternalModuleImportEqualsDeclarationExpression ,
@@ -83,7 +83,6 @@ import {
8383 ScriptElementKind ,
8484 ScriptElementKindModifier ,
8585 SemanticMeaning ,
86- SetAccessorDeclaration ,
8786 Signature ,
8887 SignatureDeclaration ,
8988 SignatureFlags ,
@@ -276,7 +275,14 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker: Type
276275 if ( symbolKind !== ScriptElementKind . unknown || symbolFlags & SymbolFlags . Class || symbolFlags & SymbolFlags . Alias ) {
277276 // If symbol is accessor, they are allowed only if location is at declaration identifier of the accessor
278277 if ( symbolKind === ScriptElementKind . memberGetAccessorElement || symbolKind === ScriptElementKind . memberSetAccessorElement ) {
279- const declaration = find ( symbol . declarations as ( ( GetAccessorDeclaration | SetAccessorDeclaration | PropertyDeclaration ) [ ] ) , declaration => declaration . name === location ) ;
278+ const declaration = find (
279+ symbol . declarations as ( AccessorDeclaration | PropertyDeclaration | PropertyAccessExpression ) [ ] ,
280+ ( declaration ) : declaration is AccessorDeclaration | PropertyDeclaration =>
281+ declaration . name === location
282+ // an expando member could have been added to an object with a set accessor
283+ // we need to ignore such write location as it shouldn't be displayed as `(setter)` anyway
284+ && declaration . kind !== SyntaxKind . PropertyAccessExpression ,
285+ ) ;
280286 if ( declaration ) {
281287 switch ( declaration . kind ) {
282288 case SyntaxKind . GetAccessor :
0 commit comments