Repository: TypeScript
Issue: Symbols in `as const` objects should be unique symbols
Labels: Suggestion,In Discussion

# Bug Report

<!--
  Please fill in each section completely. Thank you!
-->

### 🔎 Search Terms

<!--
  What search terms did you use when trying to find an existing bug report?
  List them here so people in the future can find this one more easily.
-->
symbol object "as const" 

### 🕗 Version & Regression Information

<!-- When did you start seeing this bug occur?

"Bugs" that have existed in TS for a long time are very likely to be FAQs; refer to
  https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs

If possible, please try testing the nightly version of TS to see if it's already been fixed.
For npm: `typescript@next`
This is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly

Note: The TypeScript Playground can be used to try older versions of TypeScript.

Please keep and fill in the line that best applies:
-->
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about symbol

### ⏯ Playground Link

<!--
  A link to a TypeScript Playground "Share" link which shows this behavior

  The TypeScript Workbench can be used for more complex setups, try
  https://www.typescriptlang.org/dev/bug-workbench/

  As a last resort, you can link to a repo, but these will be slower for us to investigate.
-->
[Playground link with relevant code](https://www.typescriptlang.org/play?#code/MYewdgzgLgBAgjAvDAygTwLYCMQBsAUAlANwBQoksAQkqpjgSeeNDALJoCiYArhgsgDe8ADQwaAXxgBDCDArQyAeiUw1MAHoB+UlDQAHAKbsuvfrT1GQAMxPc+cANoBrQ2hsxLhjx3v8Ausqq6tqkKjAA5iAgACakpNY8YMBQAJbgnobQcPgAbtK4AFx2ZnCEMIISullQOb6lAHRlZFA1daYODVRM4VGx1dn46Nh4REzMlCV8NEIwAMLFwwxEYgAii-Sj5VKy8ixQQeqaOuEQABYgPLgxMGAgsDwQxhGGYIYATqnAMABEEJu4H6eAyGXQgqYYGbAqy2erTFxuDxeHwdSGBMLBNShU4XK43O6wLDGf4jXDxRLJNIZVrQKh5ArFOGQ8qVAZQOlMqgNOZMGns-CchqrHqqc6Xa4wIkyMAwD7vEDvNl0pZbEhAA)

### 💻 Code

<!-- Please post the relevant code sample here as well-->
```ts
const A = Symbol();
const B = Symbol();
const MyEnumA = { A, B } as const;
//    ^?
type MyEnumA = typeof MyEnumA[keyof typeof MyEnumA];
//    ^?
// good

function testA(val: MyEnumA) {}
testA(MyEnumA.A);
testA(MyEnumA.B);
testA(Symbol()); // good type error

const MyEnumB = { C: Symbol(), D: Symbol() } as const;
//    ^?
// should not use generic "symbol" type
type MyEnumB = typeof MyEnumB[keyof typeof MyEnumB];
//    ^?
// should not be symbol

function testB(val: MyEnumB) {}
testB(MyEnumB.C);
testB(MyEnumB.D);
testB(Symbol()); // should be a type error
```

### 🙁 Actual behavior

<!-- What happened, and why it was wrong -->
Symbols in `as const`-ed objects should be `unique symbol`s, instead they're of type `symbol`.

### 🙂 Expected behavior

<!-- What you expected to happen instead, and why -->
When I write
```ts
const obj = { a: Symbol() } as const;
```
I want `obj.a` to be a `unique symbol`.

What I'm trying to do is replace TS enums with symbol-based object "enums" in some scenarios, as it gives me greater typecheck-time and runtime guarantees.

I can do
```ts
const A = Symbol();
const MyEnum = { A } as const;
type MyEnum = typeof MyEnum[keyof typeof MyEnum];
```
and that works great, but I end up with many `const ... = Symbol()` which pollute the scope and can be misused, when I'd rather do
```ts
const MyEnum = { A: Symbol() } as const;
type MyEnum = typeof MyEnum[keyof typeof MyEnum];
```