interface 定义函数
interface IFun {
(num: number): void;
}
let ifun: IFun = (num: number): void => {};
type 定义函数
type TypeFun = (num: number) => void;
let tfun: TypeFun = (num: number): void => {};
对象定义函数
interface IObj {
ofun: IFun;
}
let obj: IObj = {
ofun: (num) => {},
};
obj.ofun(123);