[英]Getting error TS1241: Unable to resolve signature of method decorator when called as an expression
I created a new project from loopback 4 cli ( lb4 app
) 我从回送4 cli( lb4 app
)创建了一个新项目
When I open the PingController with WebStorm, I see this error in the @get
decorator: 当我使用WebStorm打开PingController时,我在@get
装饰器中看到此错误:
TS1241: Unable to resolve signature of method decorator when called as an expression.
after reading here I set the target in tsconfig.json to es2017
and it indeed removed that error, but now I'm getting this error in very import line: 在这里阅读后,我将tsconfig.json中的目标设置为es2017
并确实消除了该错误,但是现在我在非常导入行中收到此错误:
TS2307: Cannot find module '@loopback/xxxxx'
Adding "module": "commonjs"
to the compiler options in tsconfig.json worked for me. 在"module": "commonjs"
中的编译器选项中添加"module": "commonjs"
对我有用。
Also make sure to use TypeScript 3.2 or later, I think the loopback-sceleton needs it. 另外,请确保使用TypeScript 3.2或更高版本,我认为回送加速器需要它。 With it, I think you shouldn't need to add the target-version, since the configuration extends from loopback. 有了它,我认为您不需要添加目标版本,因为配置是从环回扩展的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.