Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

How to pass optional parameters while omitting some other optional parameters?

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);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #pass #optional #parameters #omitting #optional
ADD COMMENT
Topic
Name
9+4 =