rintoj / ngx-virtual-scroller

Virtual Scroll displays a virtual, "infinite" list.
https://rintoj.github.io/ngx-virtual-scroller
MIT License
978 stars 294 forks source link

Projects using ngx-virtual-scroller will not compile when "noImplicitAny" is set in tsconfig.json #253

Closed jamesmikesell closed 6 years ago

jamesmikesell commented 6 years ago

Problem

Angular projects using ngx-virtual-scoller which have their tsconfig.json compilerOptions.noImplicitAny set to true fail to compile with the following error:

ERROR in node_modules/ngx-virtual-scroller/dist/virtual-scroller.d.ts(2,24): error TS7016: Could not find a declaration file for module '@tweenjs/tween.js'. '/test-app/node_modules/@tweenjs/tween.js' implicitly has an 'any' type.
  Try `npm install @types/tweenjs__tween.js` if it exists or add a new declaration (.d.ts) file containing `declare module 'tweenjs__tween.js';`

While this can be remedied by adding "@types/tween.js": "^16.9.0" to the package.json, I believe the underlying issue is that nxg-virtual-scroller should have @types/tween.js added to it's package.json dependencies section instead of it's current location in the devDependencies.

I believe this is the underlying problem in issues #210 and #227.

Suggested Resolution

Move @types/tween.js in package.json line 59 into the dependencies section (instead of it's current location of devDependencies).

speige commented 6 years ago

Good suggestion. I'll take a look.

jamesmikesell commented 6 years ago

Just realized that in addition to the above, I had to remove "types": [] from tsconfig.app.json in the project that uses ngx-virtual-scroller.

speige commented 6 years ago

I've made the change you requested & published it to npm under version 1.0.6.

Let me know if that solves the issue.

I assume I don't need to do anything in relation to the "types": [] in tsconfig.app.json that you mentioned, since that sounds like a change in the consuming app.

jamesmikesell commented 6 years ago

A this point, I don't think you need to do anything else, however I'm curious if needing to remove "types": [] in tsconfig.app.json is indicative that there is something else being missed / misconfigured.

I'll do some more investigation and re-open if i find a more elegant solution.