Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在打字稿中指定无参数函数重载。我收到以下错误:
function f():number; // Error function f(string):number; // Okay function f(x:any):any{ }
如果重载的参数数量不同,则必须将附加参数标记为可选。以下将起作用:
function f():number; // Okay now function f(string):number; // Okay function f(x?:any):any{ }