-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScript
Milestone
Description
TypeScript Version: 4.1.0-dev.20200917
Search Terms:
symbol class member uninitialized
Code
const Foo = Symbol()
class WithFoo {
[Foo]: any[]; // this shouldn't be allowed without an initialization in a constructor
Foo: any[]; // compare with this, which errors as expected
}
console.log(new WithFoo()[Foo].length) // uncaught uninitialized symbol member, oopsExpected behavior:
An error like Property 'Foo' has no initializer and is not definitely assigned in the constructor should also be emitted for the symbolic property Foo.
Actual behavior:
No such error is thrown.
Playground Link:
here
mbroadst, a-tarasyuk and ExE-Boss
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript