【发布时间】:2018-01-17 11:30:50
【问题描述】:
我有一个像这样的班级点:
class Point {
@test('admin') x: number = 6
y: number = 5
}
使用测试装饰器:
function test(myValue: string) {
function t(target: Object, propertyKey: string, descriptor:
TypedPropertyDescriptor<any>) {
//want to test y value > x value
}
return <any>t
}
在我的测试中,我想检查 y 值,例如如果 x 则抛出错误
有可能吗?
【问题讨论】:
标签: typescript object properties decorator