Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tslib problems in Angular 18

I am creating a new project in angular 18. When entering the app.component file my text editor (vscode) shows me an error in the @Component decorator."This syntax requires an imported helper but module 'tslib' cannot be found.ts(2354)"

This syntax requires an imported helper but module 'tslib' cannot be found.ts(2354)

Now the "temporary" solution I found was in the tsconfig.json file to change the moduleResolution property from "bundler" to "node".

{
  ...
  "compilerOptions": {
    ...
    "moduleResolution": "node" //"bundler"
}

Now I don't understand exactly why this happens. I already removed all my extensions from the editor and I can't find any other solution than what I already mentioned.

  • Angular CLI: 18.0.2
  • Node.js: 20.14.0
like image 678
Fernando Avatar asked Feb 01 '26 07:02

Fernando


1 Answers

I found a solution to this problem with Blunder, you just have to comment out or remove the importHelpers line from tsconfig.json and configure it in the compillerOptions of tsconfig.app.json.

tsconfig.json

tsconfig.app.json

like image 116
Axier Perlaza Avatar answered Feb 03 '26 21:02

Axier Perlaza



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!