wagerfield/parallax

npm install doesn't seem to work when using `import`

nathan-i-martin opened this issue · 6 comments

Could not find a declaration file for module 'parallax-js'. 'C:/dev/premier-properties-management/node_modules/parallax-js/dist/parallax.js' implicitly has an 'any' type. Try 'npm i --save-dev @types/parallax-js' if it exists or add a new declaration (.d.ts) file containing 'declare module 'parallax-js';

This was the issue I received from Visual Studio Code while attempting to import a fresh npm install of Parallax. import Parallax from 'parallax-js';
I've since changed it to const Parallax = require('parallax-js'); which seems to work just fine.

I did also attempt to run the npm i --save-dev @types/parallax-js command however that didn't work out.
I'm working in the Angular CLI environment (which includes babel), using typescript.

I might be wrong, but I believe this might be an issue with parallax not being written in Typescript. I might fork and work on implementing that

We'd appreciate that! I've meant to get more familiar with typescript for some time now, and this might be a good opportunity :)

Absolutely! Let me give it a shot, I've forked and have a repo open over here:
https://github.com/nmartin42/parallax-ts

@reneroth I haven't tested, a bit busy and I also figured you probably have a better system for testing than I do. However, it seems as tho I've converted everything successfully!
Please give it a shot and if you think it's good I can issue a merge request.
Please also review my commits as I've made some changes here and there, which, if you don't like you may want to remove. For the most part everything is the same however.