function logDecorator<R, Args extends unknown[], This = void>(
f: (this: This, ...args: Args) => R
): (this: This, ...args: Args) => R {
return function(...args) {
console.log(f.name, this, args);
const result = f.apply(this, args);
console.log(f.name, result);
return result;
}
}