pass multiple arguments to Omit util typescript code example
Example 1: get function return type typescript
type return_type = ReturnType<() => string>;
function hello_world(): string {
return "hello world";
}
type return_type = ReturnType<typeof hello_world>;
Example 2: 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);