const f2 = (args: {arg1: string, arg2: boolean}) => { // can re-use name
const [arg1, arg2] = [v1(args.arg1), v2(args.arg2)]; }
2 replies
Bonus: when using many scalars in arguments it can be easy to mix them up.
const f1 = (file: string, folder: string) => { } f1('/tmp', 'foo.txt'); //
spot the error?
const f2 = (args: {file: string, folder: string}) => { } f2({ file: '/tmp',
folder: 'foo.txt' }); // easier to see the error
This is especially true when the function is defined elsewhere.