Skip to content

Completions for private members appear in JavaScript files #34934

@jessetrinity

Description

@jessetrinity

When a .d.ts file is included with a .js file (ostensibly created by some .ts file in a galaxy far far away) in order to get intellisense, private class members appear in completions lists. This is probably a bug and we have gotten some feedback from users that they would rather not see this.

A possibly greater pain point is that when the private member shows up in completion, the icon is wrong, I'm guessing because we do not have the full signature for private members in .d.ts files. I believe the lack of full signatures is by design though and I don't believe there is a way to make those members appear method-like without them.

TypeScript Version: 3.6.3

Search Terms:
private completion

Code

.d.ts

// @filename:test.d.ts
/** The 'Test' namespace. */
declare namespace Test {
    /** The 'Foo' class.*/
    class Foo {
        /** Constructor. */
        constructor();
        /** I'm private: don't use me. */
        private MethodOne;
        /** I'm public: let's do this. */
        MethodTwo(): void;
    }
}

.js

// @filename:file.js
var foo = new Test.Foo();
foo.

Expected behavior:
The completion list contains MethodTwo.

Actual behavior:
The completion list contains MethodOne and MethodTwo.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Completion ListsThe issue relates to showing completion lists in an editorDomain: JavaScriptThe issue relates to JavaScript specificallyEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do thisRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions