Open nathan-i-martin opened 2 years ago
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.
@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. Typescript is one of those things where it works when it works but if it doesn't, you're basically screwed haha
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 toconst 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.