Merge pull request #38734 from a-tarasyuk/bug/34934

fix(34934): Completions for private members appear in JavaScript files
This commit is contained in:
Jesse Trinity 2020-06-02 12:47:17 -07:00 committed by GitHub
commit 463f8e10b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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"] });