TS2554

error TS2554: Expected 2 arguments, but got 1.

Bad Code ❌

1
2
3
4
5
function printName(firstName: string, lastName: string): void {
console.log(`${firstName} ${lastName}`);
}

printName('Michael');

Fixed Code ✔️

1
2
3
4
5
function printName(firstName: string, lastName: string): void {
console.log(`${firstName} ${lastName}`);
}

printName('Michael', 'Jordan');