mapbox / leaflet-omnivore

universal format parser for Leaflet & Mapbox.js
https://www.mapbox.com/mapbox.js/example/v1.0.0/omnivore-gpx/
Other
651 stars 126 forks source link

Use of Typings #86

Closed oliviercherrier closed 8 years ago

oliviercherrier commented 8 years ago

Hello,

I was trying to manage include leaflet-omnivore in a Ionic 2 / Angular 2 project.

In a first approach, I installed the leaflet-omnivore npm packages (npm install leaflet-omnivore --save) and I try to typings dt~leaflet-omnivore to get leaflet-omnivore accessible from a import * as L_o from 'leaflet-omnivore' (as from leaflet) but it seams not possible:

C:\PoPaRe>typings install dt~leaflet-omnivore --global --save

typings ERR! message Unable to find "leaflet-omnivore" ("dt") in the registry.
typings ERR! message We could use your help adding these typings to the registry : https://github.com/typings/registry
typings ERR! caused by https://api.typings.org/entries/dt/leaflet-omnivore/versi
ons/latest responded with 404, expected it to equal 200

typings ERR! cwd C:\PoPaRe
typings ERR! system Windows_NT 6.1.7601
typings ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\(...)
\AppData\\Roaming\\npm\\node_modules\\typings\\dist\\bin.js" "install" "dt~leafl
et-omnivore" "--global" "--save"
typings ERR! node -v v4.4.7
typings ERR! typings -v 1.3.3

typings ERR! If you need help, you may report this error at:
typings ERR!   <https://github.com/typings/typings/issues>

Moreover, I cannot find any leaflet-omnivore entry here: https://api.typings.org/search?query=leaflet

In a second approach, I include the leaflet-omnivore.min.js in the www/build/js folder and link in to my component using

declare var require: any;
var omnivore = require('../../../www/build/js/leaflet-omnivore.min.js');

It works but I am afraid that this solution is pretty uggly... Can you advise me on the good way to use leaflet-omnivore insied a Ionic 2 / Angular 2 project.

Thank you by advance,

Olivier.

tmcw commented 8 years ago

Hi Oliver,

Yep, what you're finding is that there are no available typings for leaflet-omnivore. Since I don't use Angular or TypeScript and rarely have free time, I haven't written them myself. You're certainly welcome to write them, and contribute them to the DefinitelyTyped repository. Closing this issue, as this isn't a problem directly with leaflet-omnivore and typings, while nice-to-have, are not a requirement to use a JavaScript library.

oliviercherrier commented 8 years ago

Hi @tmcw,

Thank your answer.

Olivier.

Avishaidev commented 6 years ago

Hi @oliviercherrier, Did you solves this?