x)- [x] bug report -> please search issues before submitting
- [ ] feature request
angular-cli v1.1.0
macOS Sierra
node 6.10.0
I just updated angular-cli (v1.1) and created a new project using ng new.
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"
}
and to angular-cli.json:
"scripts": [
"../node_modules/toastr/build/toastr.min.js",
"../node_modules/spin/dist/spin.min.js"
],
Then I updated the autogenerated app.component.ts adding this constructor:
constructor() {
toastr.success('Hi')
}
The IDE (visual studio code) recognize correctly the types but when I serve the application using ng serve I get the following error.
(I have a couple of project started 2 or 3 months ago and everything works fine)
ERROR in ../A/src/app/app.component.ts (15,5): C
annot find name 'toastr'.
Any types actually used by the application need to be added to tsconfig.app.json within the types field array.
Adding this entry:
"types": [
"../node_modules/@types/toastr"
]
does not solve the problem
try:
"types": [
"toastr"
]
Unfortunately the problem persists event with that config
It seems that removing the "types":[] from tsconfig.app.json the problem disappears
This is a typings issue, if removing "types":[] works then adding the correct one should work as well. Make sure you're adding it to the correct tsconfig though.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
It seems that removing the
"types":[]from tsconfig.app.json the problem disappears