javascript typescript function signature code example
Example 1: typescript default parameter
// Default Parameters
sayHello(hello: string = 'hello') {
console.log(hello);
}
sayHello(); // Prints 'hello'
sayHello('world'); // Prints 'world'
Example 2: types function typescript
interface Alternate_Syntax_4_Advanced {
title: string;
callback<T extends unknown[], R = unknown>(...args?: T): R;
}