TypeScript 0.9 Overload Available for Call

I have the following problem example. In TypeScript 0.9, I seem to be able to name the final signature of the overloaded method:

class Test { method(...names: string[]) : void; method(names: string[]) : void { } } var x= new Test(); x.method('One', 'Two', 'Three'); x.method(['One', 'Two', 'Three']); 

In TypeScript 0.8.x, you will need to specify a third signature, this way:

 class Test { method(...names: string[]) : void; method(names: string[]) : void; method(names: any) : void { } } var x= new Test(); x.method('One', 'Two', 'Three'); x.method(['One', 'Two', 'Three']); 

Should the final signature not be hidden? (Because it will most likely contain a generic signature with types of any , etc.).

+4
source share
1 answer

The behavior of 0.8.x is correct; we had a regression of 0.9, which is fixed in the development branch now. Implementation signatures are never really visible.

+2
source

Source: https://habr.com/ru/post/1485702/


All Articles