microsoft/typescript-go

`unique symbol` is now lost when accessed through a property

Opened this issue · 1 comments

I'm actually surprised at the Strada behavior. Consider:

const mySymbol = Symbol();
let sym = mySymbol; // Widened to type symbol

const shouldWork: typeof mySymbol = sym; // Error

The above is an error with both Strada and Corsa because we widen the unique symbol type when inferring from an initializer for a mutable location. Since the foo.sym expando property is indeed a mutable location, I'd expect widening (and thus the follow-on error) to occur in the original example, as it does with the new compiler. So, I think this is actually a bug/inconsistency in the old compiler.