const original = descriptor.value; descriptor.value = function wrapper(...args) { console.log(`called ${name}`); return original.call(this, ...args); }; return descriptor; } // 2. 2021 Current Decorators function logged(original, { name }) { return function wrapper(...args) { console.log(`called ${name}`); return original.call(this, ...args); }; } // 3. 2019 Static Decorators decorator @logged { @wrap((original) => { return function wrapper(...args) { console.log(`called ${original.name}`); return original.call(this, ...args); }; }) } // 4. 2020 Read/Write Trapping Decorators function logged() { return { set(target, instance, name, original) { return function wrapper(...args) { console.log(`called ${name}`); return original.call(this, ...args); }; }, }; } 9