简体   繁体   English

出现错误TS1241:作为表达式调用时,无法解析方法装饰器的签名

[英]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.

相关问题 打字稿 TS1241:作为表达式调用时无法解析方法装饰器的签名 - typescript TS1241: Unable to resolve signature of method decorator when called as an expression 为什么`错误:(3,1)TS1238:当作为表达式`错误调用时,无法解析类装饰器的签名 - Why `Error:(3, 1) TS1238:Unable to resolve signature of class decorator when called as an expression` error @Reflect.metadata 生成错误 TS1238:当作为表达式调用时无法解析类装饰器的签名 - @Reflect.metadata generates error TS1238: Unable to resolve signature of class decorator when called as an expression TS1238:当作为表达式调用时,无法解析类装饰器的签名 - TS1238: Unable to resolve signature of class decorator when called as an expression 作为表达式调用时无法解析属性装饰器的签名 - Unable to resolve signature of property decorator when called as an expression Vuex 模块中的 Typescript 错误“无法解析 class 装饰器的签名” - Typescript error “Unable to resolve signature of class decorator when called as an expression” in Vuex module TypeScript 装饰器报告“作为表达式调用时无法解析 class 装饰器的签名” - TypeScript decorator reports "Unable to resolve signature of class decorator when called as an expression" ES2017 NEST JS @IsEmpty 在作为表达式调用时无法解析属性装饰器的签名。此表达式不可调用。 不为空 - ES2017 NEST JS @IsEmpty Unable to resolve signature of property decorator when called as an expression.This expression is not callable. is not empty 从另一个文件导入时无法解析Typescript装饰器的签名 - Unable to resolve signature of Typescript decorator when imported from another file Visual Studio 2015:Angular 2 @Component无法解析类装饰器的签名 - Visual Studio 2015 : angular 2 @component unable to resolve signature of class decorator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM