Skip to content

Classes with symbols don't pass validation in strict mode #16819

Closed
@amir-arad

Description

@amir-arad

TypeScript Version: 2.3.3

Code
(copy-paste from the symbols documentation)

const getClassNameSymbol = Symbol();

class C {
    [getClassNameSymbol](){
       return "C";
    }
}

let c = new C();
let className = c[getClassNameSymbol](); // Error TS7017

Expected behavior:
pass walidation
Actual behavior:
TS7017:Element implicitly has an 'any' type because type 'C' has no index signature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions