Skip to content
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

Type declaration not published to NPM #40

Closed
LanceEa opened this issue Jul 12, 2021 · 3 comments
Closed

Type declaration not published to NPM #40

LanceEa opened this issue Jul 12, 2021 · 3 comments

Comments

@LanceEa
Copy link

LanceEa commented Jul 12, 2021

The type declaration file was added in #38. However, it looks like the declaration file is not being published to NPM so it doesn't show up in the node_modules/@elfalem/leaflet-curve.

Screen Shot 2021-07-12 at 10 30 45 AM

Based on the Typescript docs the two main ways are either via NPM with the library or through the @types organization on NPM.
https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html

The previous PR included the types in the package.json and I also see someone already has submitted a version to the @types organization that separate from the ones included in this repository.

https://www.typescriptlang.org/dt/search?search=leaflet-curve

So, my guess is that it just got missed during the npm publish process?

@elfalem
Copy link
Owner

elfalem commented Jul 13, 2021

Thanks for reporting this. I have published a new package (v0.8.1) to fix this.

@elfalem elfalem reopened this Jul 13, 2021
@LanceEa
Copy link
Author

LanceEa commented Jul 13, 2021

I have pulled in 0.8.2 and verified the typings are now published to NPM.

Thanks for getting this resolved so quickly!

One other thing that might be beneficial in the Readme is to point out for Typescript is they should do the following:

import { curve, Curve } from 'leaflet';
import '@elfalem/leaflet-curve';

Based on the typings the curve is imported from the leaflet module and not from the leaflet-curve module. At first I was trying to import from leaflet-curve and only saw the internal types. Which in hindsight makes since because it is a plugin extending leaflet object.

Screen Shot 2021-07-13 at 12 15 42 PM

By importing from leaflet the code is properly compiled (in my cause Angular) so that the curve function hangs off the window.L global object.

@elfalem
Copy link
Owner

elfalem commented Jul 13, 2021

I've updated the Readme. Thanks for pointing this out!

@elfalem elfalem closed this as completed Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants