TypeScript函数的多种定义方法
// TypeScript函数的多种定义方法 const addBoy1: () => string = () => { return 'XiaoMing1' } const addBoy2 = (): string => { return 'XiaoMing2' } function addBoy3():string { return 'XiaoMing3' } let boy1 = addBoy1(); let boy2 = addBoy2(); let boy3 = addBoy3(); console.log(boy1); console.log(boy2); console.log(boy3);