Skip to content

unique symbols from the global SymbolConstructor widen way too eagerly #53276

@weswigham

Description

@weswigham

Given

const a = Symbol.toStringTag;

class F {
    [a](){ return "" }
}

(new F())[a];

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

const a = Symbol();

class F {
    [a](){ return "" }
}

(new F())[a];

since Symbol.toStringTag is a unique symbol just like what Symbol() makes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Literal TypesUnit types including string literal types, numeric literal types, Boolean literals, null, undefined

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions