'This syntax requires an imported helper but module 'tslib' cannot be found.ts(2354) on VS Code(but not on build/dev)
I'm working on a repository and getting a warning in the editor:
This syntax requires an imported helper but module 'tslib' cannot be found.ts(2354)
This appears by example just on the @Component:
@Component({
selector: 'app-authenticated-layout',
templateUrl: './authenticated-layout.component.html',
styleUrls: ['./authenticated-layout.component.scss'],
})
But, if I use ng serve, it work nicely.
I've searched a bit, but in the other case, it seems that the npm install wasn't run.
Often if I close VS Code and reopen it, it works again.
Here is my package.json if it helps:
{
"name": "my-project",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --configuration=en",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"lint": "ng lint --fix",
},
"private": true,
"dependencies": {
"@angular/animations": "~13.3.0",
"@angular/common": "~13.3.0",
"@angular/compiler": "~13.3.0",
"@angular/core": "~13.3.0",
"@angular/forms": "~13.3.0",
"@angular/localize": "~13.3.0",
"@angular/platform-browser": "~13.3.0",
"@angular/platform-browser-dynamic": "~13.3.0",
"@angular/router": "~13.3.0",
"@ngxs/devtools-plugin": "^3.3.2",
"@ngxs/logger-plugin": "^3.3.2",
"@ngxs/schematics": "^0.0.1-alpha.5",
"@ngxs/store": "^3.3.2",
"@progress/kendo-angular-buttons": "^8.0.0",
"@progress/kendo-angular-common": "^3.0.0",
"@progress/kendo-angular-icons": "^2.0.0",
"@progress/kendo-angular-indicators": "^2.0.0",
"@progress/kendo-angular-inputs": "^9.0.0",
"@progress/kendo-angular-intl": "^4.0.0",
"@progress/kendo-angular-l10n": "^4.0.0",
"@progress/kendo-angular-layout": "^7.0.0",
"@progress/kendo-angular-messages": "^1.32.2",
"@progress/kendo-angular-navigation": "^2.0.0",
"@progress/kendo-angular-popup": "^5.0.0",
"@progress/kendo-angular-progressbar": "^3.0.0",
"@progress/kendo-angular-typography": "^2.0.0",
"@progress/kendo-drawing": "^1.5.12",
"@progress/kendo-licensing": "^1.0.0",
"@progress/kendo-svg-icons": "^0.1.2",
"@progress/kendo-theme-bootstrap": "^5.3.1",
"bootstrap": "^5.1.3",
"jwt-decode": "^3.1.2",
"primeflex": "^3.1.3",
"rxjs": "~7.5.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~13.3.1",
"@angular-eslint/builder": "13.2.0",
"@angular-eslint/eslint-plugin": "13.2.0",
"@angular-eslint/eslint-plugin-template": "13.2.0",
"@angular-eslint/schematics": "13.2.0",
"@angular-eslint/template-parser": "13.2.0",
"@angular/cli": "^13.3.3",
"@angular/compiler-cli": "~13.3.0",
"@ngxs/devtools-plugin": "^3.7.3",
"@ngxs/schematics": "^0.0.1-alpha.5",
"@types/crypto-js": "^4.1.1",
"@types/jasmine": "~3.10.0",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "5.17.0",
"@typescript-eslint/parser": "5.17.0",
"crypto-js": "^4.1.1",
"eslint": "^8.12.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"git-pull-run": "^1.0.2",
"husky": "^7.0.4",
"jasmine-core": "~4.0.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.1.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"ng-mocks": "^13.4.1",
"prettier": "^2.6.2",
"prettier-eslint": "^13.0.0",
"tslib": "^2.4.0",
"typescript": "~4.6.2"
}
}
Any idea what is going on?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
