robertleeplummerjr / Leaflet.glify

fully functional, ridiculously fast web gl renderer plugin for leaflet
https://robertleeplummerjr.github.io/Leaflet.glify
MIT License
474 stars 84 forks source link

Type declarations seemingly missing when installed from npm #121

Closed smari closed 2 years ago

smari commented 2 years ago

Hi!

I have leaflet.glify 3.2.0 installed from NPM (which seems weird since 2.1.0 is the highest release here on Github?). I'm importing it into a typescript project with:

import glify from 'leaflet.glify';

as indicated but get the following complaint:

ERROR in src/components/es/GEMBaseMap.tsx:4:19
TS7016: Could not find a declaration file for module 'leaflet.glify'. '[redacted]/frontend/node_modules/leaflet.glify/dist/glify.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/leaflet.glify` if it exists or add a new declaration (.d.ts) file containing `declare module 'leaflet.glify';`

Obviously those types aren't available and there are no module declarations for leaflet.glify in the code as shipped. Any idea what might be going on here?

Thanks!

ivan-palatov commented 2 years ago

The project does have lines for emitting declarations commented out for some reason. To work around that you could just fork it, uncomment the declaration-related lines in tsconfig and install your fork instead.

smari commented 2 years ago

That's not a great solution, but thanks for the response. I actually ended up just implementing my own GL layer support; it was less hassle and allowed me to get closer to what I wanted anyway. Thanks though!