Cannot find type definition file for 'applicationinsights-js'
stas-kh opened this issue ยท 4 comments
Hey Mark,
Thank you for the work you do.
I would like to post a new bug that has appeared recently, in the latest version of the library (5.0.4)
Type: Bug
Environment:
- NodeJS - 8.9.0
- npm - 5.5.1
- Angular - ^6.1.6
- Angular CLI - ^6.1.5
Steps to recreate:
- Create a new project on Angular 6
- Include ng-application-insights library following the instructions
- Run
ng serve
- Check the console
Date: 2018-09-17T16:20:02.648Z
Hash: 49ac821e4e4d98eadfa2
Time: 15821ms
chunk {main} main.js, main.js.map (main) 1.88 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 660 bytes [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 5.22 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 625 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 325 kB [initial] [rendered]
ERROR in node_modules/@markpieszak/ng-application-insights/dist/src/app-insight.service.d.ts(1,23): error TS2688: Cannot find type definition file for 'applicationinsights-js'.
node_modules/@markpieszak/ng-application-insights/dist/src/app-insight.service.d.ts(3,23): error TS2503: Cannot find namespace 'Microsoft'.
node_modules/@markpieszak/ng-application-insights/dist/src/app-insight.service.d.ts(4,51): error TS2503: Cannot find namespace 'Microsoft'.
node_modules/@markpieszak/ng-application-insights/dist/src/app-insight.service.d.ts(43,14): error TS2503: Cannot find namespace 'Microsoft'.
node_modules/@markpieszak/ng-application-insights/dist/src/app-insight.service.d.ts(76,24): error TS2503: Cannot find namespace 'AI'.
node_modules/@markpieszak/ng-application-insights/dist/src/app-insight.service.d.ts(79,24): error TS2503: Cannot find namespace 'AI'.
I think the issue is that @types/applicationinsights-js
is in devDependencies. It should be in regular dependencies, hence why your project isn't picking it up.
My simple workaround was to just install it manually in my project -
npm i --save-dev @types/applicationinsights-js
@AustinBrunkhorst thanks for the suggestion, I believe you are right.
I see that the author has moved the typings to peerDependencies
in the scope of this commit
Waiting for a comment from @MarkPieszak.
Oh shoot did that move somehow??
I might of been trying to update it and accidentally did a --D
to save-dev ๐คฆโโ๏ธ
Let me fix that and release a minor patch release!
Sorry about that everyone!
Fixed! Published to npm as 5.0.5
npm notice ๐ฆ @markpieszak/ng-application-insights@5.0.5
@stas-kh @AustinBrunkhorst
Thanks for spotting and figuring this one out guys!