fix(34934): exclude private properties from Js completion list

This commit is contained in:
Alexander T 2020-05-22 15:11:39 +03:00
parent 3eaa7c65f6
commit 4c278aa33b
2 changed files with 21 additions and 1 deletions

View file

@ -1235,7 +1235,7 @@ namespace ts.Completions {
// each individual type has. This is because we're going to add all identifiers
// anyways. So we might as well elevate the members that were at least part
// of the individual types to a higher status since we know what they are.
symbols.push(...getPropertiesForCompletion(type, typeChecker));
symbols.push(...filter(getPropertiesForCompletion(type, typeChecker), s => typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s)));
}
else {
for (const symbol of type.getApparentProperties()) {

View file

@ -0,0 +1,20 @@
/// <reference path="fourslash.ts" />
// @allowJs: true
// @Filename: a.d.ts
////declare namespace A {
//// class Foo {
//// constructor();
////
//// private m1(): void;
//// protected m2(): void;
////
//// m3(): void;
//// }
////}
// @filename: b.js
////let foo = new A.Foo();
////foo./**/
verify.completions({ marker: [""], includes: ["m3"], excludes: ["m1", "m2"] });