variable x is defined & initialized by a method initNum which is called in the constructor but typescript keeps throwing an error:
Property 'x' has no initializer and is not definitely assigned in the constructor.(2564)
Edit: It is not supposed to throw an error because x is initialized. Is there a bug in the code or I'm supposed to add some rule to tsconfig?
Edit-2: This is different from this question: Property '...' has no initializer and is not definitely assigned in the constructor
1- It's not Angular
2- There's a clear initiation for x assigned directly to the constructor by a function.
3- It's synchronized.
class Point {
  x: number;
  constructor() {
    this.initNum()
    }
    initNum(){
    this.x = 0;
    }
}