fix(34934): exclude private properties from Js completion list
This commit is contained in:
parent
3eaa7c65f6
commit
4c278aa33b
|
@ -1235,7 +1235,7 @@ namespace ts.Completions {
|
||||||
// each individual type has. This is because we're going to add all identifiers
|
// 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
|
// 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.
|
// 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 {
|
else {
|
||||||
for (const symbol of type.getApparentProperties()) {
|
for (const symbol of type.getApparentProperties()) {
|
||||||
|
|
20
tests/cases/fourslash/completionsPrivateProperties_Js.ts
Normal file
20
tests/cases/fourslash/completionsPrivateProperties_Js.ts
Normal 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"] });
|
Loading…
Reference in a new issue