Symbol = LiveSymbol | DeadSymbol #59574
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
π Search Terms
symbol weakmap TC39
β Viability Checklist
β Suggestion
The latest version of ES creates a new kind of runtime error. It allows symbols to be used as weak map keys, but only some symbols. In particular it splits the symbol primitive in two. One one hand are "live" symbols, tracked by the garbage collector, and usable as weak map keys.
Symbol()
creates a live symbol. On the other had are "dead" symbols, such asSymbol.iterator
, which return some value fromSymbol.keyFor(sym)
and are not legal keys for weak maps.Since there are now fundamentally two incompatible primitive types, TS should adjust so that it is capable of catching these errors again.
π Motivating Example
π» Use Cases
Catching more errors
The text was updated successfully, but these errors were encountered: