3 ms·
De-structuring syntax isn't required, this is just as easily type-checked: interface CopyArgs { src: string; dst: string; } functi
by tomjakubowski 7y ago
De-structuring syntax isn't required, this is just as easily type-checked:
interface CopyArgs {
src: string;
dst: string;
}
function copy(args: CopyArgs) {
exec(["cp", args.src, args.dst])
}
- thelazydogsback 7y agoSure, if you want to get all interfacy - but pretty soon it'll be Java :)
- davedx 7y agoHah I thought that initially, but TypeScript interfaces are simpler (and usually co-sited) compared to their OO cousins. I find them a pleasure to use.