Functions with many parameters are hard to call correctly — which order do the args go?
// dirty — 5 positional arguments
function solve(firstName: string, lastName: string, age: number, email: string, role: string) {
return { firstName, lastName, age, email, role };
}Refactor so solve accepts a single options object instead of 5 positional arguments.
solve({ firstName: 'Alice', lastName: 'Smith', age: 30, email: 'a@b.com', role: 'admin' })
Sample tests