implements类的函数重载需要在类中声明与所实现接口一致的函数重载声明【ts 4.1.3】
interface Test {
t1(p: string): number;
t1(p: number): string;
}
class TestClass implements Test {
t1(p: string): number;
t1(p: number): string;
t1(p: string | number) {
return typeof p === 'string' ? Number(p) : String(p);
}
}