In the video I've found that interfaces can use strange overload technique. The code below is compiled but does not work. I have some questions, all of them are placed inside of the code:
interface X{
// how can the class implements such overload ?
f:{
(s:string):string;
(s:number):string;
data:any;
};
}
class xxx
{
// how to initialize this structure ?
f:{
(s:string):string;
(s:number):string;
data:any;
};
}
var x = new xxx();
// how should the class xxxx look to be used with this function ?
function a(x:X):string{
return x.f("1");
}
a(x);
See Question&Answers more detail:os