typescript 实现函数重载
class Demo {
// #region 声明
log() : void;
log(arg1: string): void;
log(arg1: number, arg2: string): void;
// #endregion
// 实现
log(arg1?: string | number, arg2?: string) {
}
}
class Demo {
// #region 声明
log() : void;
log(arg1: string): void;
log(arg1: number, arg2: string): void;
// #endregion
// 实现
log(arg1?: string | number, arg2?: string) {
}
}