Open
Description
Link: here
Minimal reproduction: (as far as I can reduce it)
class B {}
class A {
b: B;
c: B;
constructor() {
// this should be safe?
this.b = new B();
this.c = this.b;
}
}
export function fib(n: i32): i32 {
let a = new A();
return 0;
}
Error:
;; ERROR TS2564: Property 'module/A#c' has no initializer and is not assigned in the constructor before 'this' is used or returned.
;; :
;; 4 │ c: B;
;; │ ~
;; └─ in module.ts(4,3)
;; :
;; 7 │ this.c = this.b;
;; │ ~~~~~~
;; └─ in module.ts(7,14)