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, oops
Expected 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
TypeScript Version: 4.1.0-dev.20200917
Search Terms:
symbol class member uninitialized
Code
Expected behavior:
An error like
Property 'Foo' has no initializer and is not definitely assigned in the constructorshould also be emitted for the symbolic propertyFoo.Actual behavior:
No such error is thrown.
Playground Link:
here