Repository: TypeScript
Issue: Intellisense for Symbol properties
Labels: Suggestion,Domain: Completion Lists,Awaiting More Feedback

# Suggestion

<!--
  Please fill in each section completely. Thank you!
-->

## 🔍 Search Terms

<!--
  💡 Did you know? TypeScript has over 2,000 open suggestions!
  🔎 Please search thoroughly before logging new feature requests as most common ideas already have a proposal in progress.
  The "Common Feature Requests" section of the FAQ lists many popular requests: https://github.com/Microsoft/TypeScript/wiki/FAQ#common-feature-requests

  Replace the text below:
-->

With and without "is:issue is:open"
"symbol intellisense"
"symbol autocomplete"

## ✅ Viability Checklist

<!--
   Suggestions that don't meet all these criteria are very, very unlikely to be accepted.
   We always recommend reviewing the TypeScript design goals before investing time writing
   a proposal for ideas outside the scope of the project.
-->
My suggestion meets these guidelines:

* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
* [x] This wouldn't change the runtime behavior of existing JavaScript code
* [x] This could be implemented without emitting different JS based on the types of the expressions
* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).


## ⭐ Suggestion

Intellisense provides a list of symbol properties which, when accepted, insert indexed accessor syntax for that symbol. This list would be comprised of known symbols within the current scope or those that can be with an import statement.

## 📃 Motivating Example

This example demonstrates a type that implements the global `Disposable` interface introduced by TC39 ECMAScript Explicit Resource Management. (#54505)

```typescript
class ExampleClass implements Disposable {
  [Symbol.dispose](): void {
    // ...
  }
}

const example = new ExampleClass();

example[Symbol.dispose]();
```
The suggestions shown for `example.` do not include`Symbol.dispose`.

## 💻 Use Cases

TL;DR: `Symbol.dispose` and `Symbol.asyncDispose` are the first well-known symbols that are useful to call directly, and I want to easily know that they're there.

Typically, ES6 Symbols are intended as an implementation detail, but the new global `Disposable` interface, however, is analogous to this very prolific interface:
```typescript
interface Disposable {
  dispose(): void;
}
```

In order to support `using` syntax, I need to implement the global `Disposable` interface. I have a few options:

- Switch to the global `Disposable` interface, but lose the visibility to developers of the lifecycle management requirements of implementations.
- Make my `Disposable` interface extend the global `Disposable` interface, or possibly merge it with the global one and then, by convention, do the following:
```typescript
dispose(): void {
  // ...
}

[Symbol.dispose](): void {
  this.dispose();
}
```
An option is to create a utility class decorator that does that for me, but unfortunately that creates the issue of how to make that class recognized as an implementation of the global `Disposable`. (#4881)