Closed
Description
TypeScript Version: 3.4.0-dev.201xxxxx
Search Terms:
Code
const _sym = Symbol("_sym");
class MyClass {
constructor() {
this[_sym] = "ok";
}
method() {
this[_sym] = "yep";
const x = this[_sym];
}
}
included in a js file in a project with checkJs
on.
Expected behavior:
MyClass
has a member named [_sym]
. Everything checks out.
Actual behavior:
Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'MyClass'.
Saw this while working on #32372 while looking at a suggestion on tapjs/tapjs#256. I think we'll want this fixed up for the next release, so it's ready alongside the js declaration emitter.