Bug Report
π Search Terms
symbol property constructor 2564
π Version & Regression Information
- This changed between versions 4.6.4 and 4.7.4
β― Playground Link
Playground link with relevant code
π» Code
const standaloneSymbol = Symbol("standalone");
class SymbolClass {
static readonly staticSymbol = Symbol("static");
}
interface IHaveSymbols {
[standaloneSymbol]: number;
[SymbolClass.staticSymbol]: number;
}
class HavePropertyInitializedSymbols implements IHaveSymbols {
[standaloneSymbol] = 1;
[SymbolClass.staticSymbol] = 2;
}
class HaveOverriddenSymbols extends HavePropertyInitializedSymbols {
constructor() {
super();
this[standaloneSymbol] = 3;
this[SymbolClass.staticSymbol] = 4;
}
}
class HaveConstructorInitializedSymbols implements IHaveSymbols {
[standaloneSymbol]: number;
[SymbolClass.staticSymbol]: number;
constructor() {
this[standaloneSymbol] = 3;
this[SymbolClass.staticSymbol] = 4;
}
}
π Actual behavior
Property '[SymbolClass.staticSymbol]' has no initializer and is not definitely assigned in the constructor.(2564)
(property) SymbolClass.staticSymbol: typeof SymbolClass.staticSymbol
It's wrong because the property is definitely assigned in the constructor
π Expected behavior
No error, because the property is definitely assigned in the constructor
Bug Report
π Search Terms
symbol property constructor 2564
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
It's wrong because the property is definitely assigned in the constructor
π Expected behavior
No error, because the property is definitely assigned in the constructor