-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm install doesn't seem to work when using import
#318
Comments
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: |
@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! |
@nathan-i-martin thanks for the effort! I'd love to just keep this as a separate repository for now, since I (as you might've noticed sorry) barely have any time for stuff besides work and other grown up people things, so maintenance would be hard. Would it be possible to only add the types definitions without changing the original JS file? I am a bit confused though why it does not work by default, since I always assumed typescript was compatible with vanilla javascript? |
Hey! I wrote this a while ago and it also was incomplete so forgive me if my memory isn't totally accurate on the issue. I also assumed the same thing. Maybe newer versions of TS work with it. Theoretically tho someone should be able to import it as an "any" object and it would work. Like I said, it's been a minute since I've used parallax in a project so I'd have to test. |
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.
The text was updated successfully, but these errors were encountered: