function add(x:number,y:number):number{
return x+y;
}
let myAdd: (x:number,y:number) =>number =function(x:number,y:number):number{
return x+y;
}
let myAdd2: (x:number,y:number) =>number = function(x,y){return x+y}
//可选参数:必须为最后一个参数
function prop(prop1:string,prop2?:string):string{return prop1+prop2}
//参数默认值,可以在任意位置
function prop2(prop1='me',prop2:string):string{return prop1+prop2}
//任意参数
function prop3(prop1:string,...propN:string[]):string{return prop1+propN.join('')}
//指定this的类型
function fn(this:void){}
//重载
function refn(x: {suit:string,card:string}[]):number;
function refn(x:number):{suit:string,card:string};
function refn(x):any{
}