简体   繁体   中英

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 )

When I open the PingController with WebStorm, I see this error in the @get decorator:

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:

TS2307: Cannot find module '@loopback/xxxxx'

Adding "module": "commonjs" to the compiler options in tsconfig.json worked for me.

Also make sure to use TypeScript 3.2 or later, I think the loopback-sceleton needs it. With it, I think you shouldn't need to add the target-version, since the configuration extends from loopback.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM