Skip to content

Commit 463f8e1

Browse files
authored
Merge pull request microsoft#38734 from a-tarasyuk/bug/34934
fix(34934): Completions for private members appear in JavaScript files
2 parents 9fbcb99 + 4c278aa commit 463f8e1

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/services/completions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ namespace ts.Completions {
12351235
// each individual type has. This is because we're going to add all identifiers
12361236
// anyways. So we might as well elevate the members that were at least part
12371237
// of the individual types to a higher status since we know what they are.
1238-
symbols.push(...getPropertiesForCompletion(type, typeChecker));
1238+
symbols.push(...filter(getPropertiesForCompletion(type, typeChecker), s => typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s)));
12391239
}
12401240
else {
12411241
for (const symbol of type.getApparentProperties()) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @allowJs: true
4+
// @Filename: a.d.ts
5+
////declare namespace A {
6+
//// class Foo {
7+
//// constructor();
8+
////
9+
//// private m1(): void;
10+
//// protected m2(): void;
11+
////
12+
//// m3(): void;
13+
//// }
14+
////}
15+
16+
// @filename: b.js
17+
////let foo = new A.Foo();
18+
////foo./**/
19+
20+
verify.completions({ marker: [""], includes: ["m3"], excludes: ["m1", "m2"] });

0 commit comments

Comments
 (0)