【发布时间】:2016-10-08 05:44:10
【问题描述】:
我的测试代码如下:
function test(target: Object, propertyKey: string, descriptor: TypedPropertyDescriptor<any>) {
return descriptor;
}
class Test {
@test
hello() {
}
}
但是编译器给我错误
Error:(33, 5) TS1241: Unable to resolve signature of method decorator when called as an expression.
Supplied parameters do not match any signature of call target.
我已经指定: --experimentalDecorators --emitDecoratorMetadata
【问题讨论】:
-
它对我有用。你正在编译哪个版本的打字稿?
-
tsc test.ts --experimentalDecorators --emitDecoratorMetadata
-
@iberbeu tsc --version 版本 1.8.10
-
如何将此
TypedPropertyDescriptor<any>更改为PropertyDescriptor并将target: Object更改为target: any?您的声明似乎没有被识别 -
@Jeff 您在哪里可以解决/解决这个问题?我也有同样的问题
标签: typescript decorator