Repository navigation
unique symbols from the global SymbolConstructor widen way too eagerly #53276
Description
Activity
- addedBugA bug in TypeScriptA bug in TypeScriptDomain: Literal TypesUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedUnit types including string literal types, numeric literal types, Boolean literals, null, undefined
on Mar 15, 2023 Wait, why is a well-known symbol typed as
unique symbol? That feels wrong to me.weswigham commented
on Mar 16, 2023 MemberAuthorMore actionsBecause it's a specific, unique symbol. As a matter of fact, we don't even have the concept of a "well-known" symbol anymore -
unique symbols subsumed them as the more general concept (the termwell knownno longer appears anywhere in the checker's code, just some old comments!).Reacted by Bruce Pascoe and ExE BossI guess I just always saw
unique symbolas this special nominal type that every time it's mentioned, refers to a distinct type, so it feels weird to apply that to values that are predefined by the runtime. IOWunique symbolimplies to me a value that can't be forgedRyanCavanaugh commented
on Sep 19, 2026 MemberMore actionsThe original example is fixed. With
--strict --lib es2015, it produced TS7053 through5.7.0-dev.20240923and is clean in5.7.0-dev.20240924, TypeScript 6.0.3, and current native TypeScript.The change is PR #59860, which makes non-literal computed class members participate in the class type rather than being dropped.
- addedFixedA PR has been merged for this issueA PR has been merged for this issueNeeds Human ReviewThis issue has a backlog check awaiting maintainer review.This issue has a backlog check awaiting maintainer review.
on Sep 19, 2026 - removedNeeds Human ReviewThis issue has a backlog check awaiting maintainer review.This issue has a backlog check awaiting maintainer review.
on Sep 23, 2026
Given
we currently issue a
Element implicitly has an 'any' type because expression of type 'symbol' can't be used to index type 'F'.(7053)error on the access.There should be no errors, as with
since
Symbol.toStringTagis aunique symboljust like whatSymbol()makes.