Skip to content

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

Open
@weswigham

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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