Open gogoend opened 1 year ago
/** * @param { TFunction } target 被装饰的类 */ type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
/** * @param { TFunction } target 被装饰的类 * @param { string | symbol } propertyKey 属性的key */ type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
/** * @param { TFunction } target 被装饰的方法 * @param { string | symbol } propertyKey 方法的key * @param { TypedPropertyDescriptor<T> } descriptor 属性描述符 */ type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
/** * @param { TFunction } target 被装饰的方法 * @param { string | symbol } propertyKey 方法的key - 若被装饰的参数位于constructor,此处key将为`undefined` * @param { number } parameterIndex 参数所在索引 */ type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
类装饰器
属性装饰器
方法装饰器
参数装饰器