Closed
Description
public myMethod();
private myMethod(Data?:T,FromRevision?:number,TilRevision?:number);
public myMethod(Data?:T,FromRevision:number=0,TilRevision:number=0) {
...
}
gives:
error TS2385: Overload signatures must all be public, private or protected.
What is this restriction needed for? Of course a possible workaround is an internal helper function:
private myMethodInternal(Data?:T,FromRevision:number=0,TilRevision:number=0) {
...
}
public myMethod() {
this.myMethodInternal();
}
But it is just unnecessary work and unnecessary function calls (performance, when called often).
Even worse, when i try to do this on a constructor, it complains:
error TS1089: 'private' modifier cannot appear on a constructor declaration.
Why not? I wanted to have a constructor, which is only accessible by methods inside the class and allows to specify additional parameters to the constructor, which would else hold their default values. Of course, the workaround above also works in this situation.