Skip to content

Commit 31230b9

Browse files
authored
Merge pull request #16953 from charlespierce/destructure_completion_nonpublic
Remove nonpublic members from destructuring completion lists
2 parents aa0fc0b + 228ce06 commit 31230b9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/services/completions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ namespace ts.Completions {
10001000
const typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer);
10011001
if (!typeForObject) return false;
10021002
// In a binding pattern, get only known properties. Everywhere else we will get all possible properties.
1003-
typeMembers = typeChecker.getPropertiesOfType(typeForObject);
1003+
typeMembers = typeChecker.getPropertiesOfType(typeForObject).filter((symbol) => !(getDeclarationModifierFlagsFromSymbol(symbol) & ModifierFlags.NonPublicAccessibilityModifier));
10041004
existingMembers = (<ObjectBindingPattern>objectLikeContainer).elements;
10051005
}
10061006
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
////const { b/**/ } = new class {
4+
//// private ab;
5+
//// protected bc;
6+
////}
7+
8+
goTo.marker();
9+
verify.completionListIsEmpty();

0 commit comments

Comments
 (0)