In languages with C #, for example, you can use the builder overload as shown below:
public class Teste{
public Teste(bool a, int b, string c){ }
public Teste(bool a, int b){ }
public Teste(bool a){ }
}
After some time searching I was able to perform the constructor overload in TypeScript like this:
export class Telefone {
constructor(a: boolean);
constructor(a: boolean, b: number);
constructor(a: boolean, b: number, c: string);
constructor(public a?: boolean, public b?: number, c?: string){ }
}
Is there another way to accomplish this? This way above does not resolve overloads like this:
public Teste(bool a){}
public Teste(int b){}