MethodDecorator = (target: Object, key: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | Void;
PropertyDecorator = (target: Object, key: string) => void;
ClassDecorator = (target: TFunction) => TFunction;
function funcDecorator(target, key, desc) {
console.log('funcDecorator_target', target);
console.log('funcDecorator_key', key);
console.log('funcDecorator_desc', desc);
return desc;
}
function propDecorator(target, key) {
console.log('propDecorator_target', target);
console.log('propDecorator_key', key);
}
function classDecorator(target) {
console.log('classDecorator_target', target);
return target;
}
@classDecorator
export class Test {
@propDecorator
public name: string = '';
@funcDecorator
public log(): void {}
}