为了账号安全,请及时绑定邮箱和手机立即绑定

如何实现打字稿装饰器?

如何实现打字稿装饰器?

如何实现打字稿装饰器?TypeScript 1.5现在有装饰器。有人可以提供一个简单的例子来演示实现装饰器的正确方法,并描述可能的有效装饰器签名中的参数是什么意思吗?declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;declare type ParameterDecorator = (target: Function, propertyKey: string | symbol, parameterIndex: number) => void;另外,在实现装饰器时是否应该记住哪些最佳实践注意事项?
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 536 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信