π Search Terms
private fields suggestions
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about private fields
β― Playground Link
https://www.typescriptlang.org/play?#code/C4TwDgpgBAogHgQwLZgDYQJIDsCWwoC8UA3gFBQVQBmA9jQFxRYCuSARhAE4A0pAvgG5SpUJFiIU6ADI4A1tCLxkaaAB9xy9NjxDSAY1QIAzkY2ToZSlCPAEwHHqg4jS8wAoAbglTMIjBFggAJSMXj7QzmYqJORWlJwQwMycWFAAxLQ0TqlhvkJWfMJWNnYO1Jw0SG4QEioy8oyudXIQIVHoMXGUOFRQbk3oAHTOAxDVtdItQUGdXXEJSSlQNZoQ9RD5c4VzUAvJqVgQAO7tYyvm60GbFIWxFAkIACY0WKgg6ZmMLOxculZ6LxsnGYemANE4bmI1DoUD4jQmmFwwBmljmwAAFs5BhkYURMtdYfxhACsDZlgjCKdBlQKlVURQAPQMqAAFU471EOCwAHMoAAiKh8qABR7WCDQDF2KAYrgRUwIazMbnciA2HAvaGcD50fhXUhAA
π» Code
type ExampleInit = {
foo: number,
};
type ExampleLike = Example | ExampleInit;
class Example {
static isExample(value: any): value is Example {
return #foo in value;
}
static from(exampleLike: ExampleLike): Example {
if (Example.isExample(exampleLike)) {
return exampleLike;
}
return new Example(exampleLike);
}
readonly #foo: number;
constructor({ foo }: ExampleInit) {
this.#foo = foo;
}
}
const example = Example.from({
// Try typing "f" and see that there is a suggestion for #foo
});
π Actual behavior
We get suggestions for private fields:

This is particularly annoying as the private fields tend to be suggested first, so tab-completion tends to produce broken code.
π Expected behavior
The private field should not be included as a suggestion when outside the class scope where the field is defined.
Additional information about the issue
No response
π Search Terms
private fields suggestions
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?#code/C4TwDgpgBAogHgQwLZgDYQJIDsCWwoC8UA3gFBQVQBmA9jQFxRYCuSARhAE4A0pAvgG5SpUJFiIU6ADI4A1tCLxkaaAB9xy9NjxDSAY1QIAzkY2ToZSlCPAEwHHqg4jS8wAoAbglTMIjBFggAJSMXj7QzmYqJORWlJwQwMycWFAAxLQ0TqlhvkJWfMJWNnYO1Jw0SG4QEioy8oyudXIQIVHoMXGUOFRQbk3oAHTOAxDVtdItQUGdXXEJSSlQNZoQ9RD5c4VzUAvJqVgQAO7tYyvm60GbFIWxFAkIACY0WKgg6ZmMLOxculZ6LxsnGYemANE4bmI1DoUD4jQmmFwwBmljmwAAFs5BhkYURMtdYfxhACsDZlgjCKdBlQKlVURQAPQMqAAFU471EOCwAHMoAAiKh8qABR7WCDQDF2KAYrgRUwIazMbnciA2HAvaGcD50fhXUhAA
π» Code
π Actual behavior
We get suggestions for private fields:
This is particularly annoying as the private fields tend to be suggested first, so tab-completion tends to produce broken code.
π Expected behavior
The private field should not be included as a suggestion when outside the class scope where the field is defined.
Additional information about the issue
No response