📜  如何在省略其他一些可选参数的同时传递可选参数? - 打字稿代码示例

📅  最后修改于: 2022-03-11 14:48:15.094000             🧑  作者: Mango

代码示例1
export interface INotificationService {
    error(message: string, title?: string, autoHideAfter? : number);
}

class X {
    error(message: string, title?: string, autoHideAfter?: number) {
        console.log(message, title, autoHideAfter);
    }
}

new X().error("hi there", undefined, 1000);