I just updated angular-cli (v1.1) and created a new project using ng new MyProj.
Then I added and installed two dependencies to the project.json file:
"dependencies": {
...
"toastr": "2.1.2",
"spin": "0.0.1"
},
"devDependencies": {
...
"@types/toastr": "2.1.32",
"@types/spin": "2.3.30",
...
"typescript": "~2.3.3"
}
Then I updated the autogenerated app.component.ts adding this constructor:
constructor() {
toastr.success('Hi')
}
The IDE (visual studio code) do not return any error but when I serve the application using ng serve I get the following error:
ERROR in ../A/src/app/app.component.ts (15,5): C annot find name 'toastr'.
I really cannot figure out what is wrong with that.
Thanks a lot
I solved the problem removing types from tsconfig.app.json.
This is the new configuration:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"baseUrl": ""
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With