签名如下:
export interface INotificationService {
error(message: string, title?: string, autoHideAfter?: number);
}
如何调用函数error()
not指定title
参数,但将autoHideAfter
设置为1000
?
签名如下:
export interface INotificationService {
error(message: string, title?: string, autoHideAfter?: number);
}
如何调用函数error()
not指定title
参数,但将autoHideAfter
设置为1000
?
按照documentation中的规定,使用undefined
:
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);