mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 15:45:27 -05:00
Don't filter away private completions if in the same context
Fixes #34405, which was introduced in PR #16953.
This commit is contained in:
@@ -1826,8 +1826,14 @@ namespace ts.Completions {
|
||||
if (canGetType) {
|
||||
const typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer);
|
||||
if (!typeForObject) return GlobalsSearch.Fail;
|
||||
// In a binding pattern, get only known properties. Everywhere else we will get all possible properties.
|
||||
typeMembers = typeChecker.getPropertiesOfType(typeForObject).filter((symbol) => !(getDeclarationModifierFlagsFromSymbol(symbol) & ModifierFlags.NonPublicAccessibilityModifier));
|
||||
// In a binding pattern, get only known properties (unless in the same scope).
|
||||
// Everywhere else we will get all possible properties.
|
||||
const containerClass = getContainingClass(objectLikeContainer);
|
||||
typeMembers = typeChecker.getPropertiesOfType(typeForObject).filter(symbol =>
|
||||
// either public
|
||||
!(getDeclarationModifierFlagsFromSymbol(symbol) & ModifierFlags.NonPublicAccessibilityModifier)
|
||||
// or we're in it
|
||||
|| containerClass && contains(typeForObject.symbol.declarations, containerClass));
|
||||
existingMembers = objectLikeContainer.elements;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user