I've been experimenting with decorators in TypeScript, but encountered an error when compiling the code:
error TS1241: Unable to resolve signature of method decorator when called as an expression.
error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
I've configured the decorator correctly in tsconfig.json :
{
"compilerOptions": {
"target" : "ES5",
"experimentalDecorators" : true,
"emitDecoratorMetadata" : true
}
}
Despite trying various solutions from online resources, I haven't been able to resolve this persistent issue.
TSC version 3.4.2
One possible explanation I found is that during compilation of the TypeScript code, the decorator is being called with one less argument:
__decorate([
f()
], C.prototype, "ffolow");
The following code snippet demonstrates the usage of the decorator within the "C" class:
class C {
@f()
ffolow() {
console.log("FF called")
}
}