tyrasd / osmtogeojson

convert osm to geojson
http://tyrasd.github.io/osmtogeojson/
MIT License
683 stars 112 forks source link

Typing of osmtogeojson's first arg is "any" #120

Open toolness opened 4 years ago

toolness commented 4 years ago

Hello! Thanks for this great module. I noticed that the typing of the osmtogeojson function is:

    export interface OsmToGeoJsonStatic {
        // tslint:disable-next-line:no-any
        (data: any, options?: OsmToGeoJSONOptions): FeatureCollection<GeometryObject>;
    }

Given the lack of an example of this argument in the README, I assumed I could just pass in a string containing XML, but I was wrong! The function exploded with a confusing exception. Once I found out that it needed to be an XML DOM, I looked at this project's dependencies and noticed it used xmldom, so I installed that and used it.

It seems like rather than any, this should really be a union of Document and the funky JSON type it accepts, maybe? Or maybe it should throw an error if a string is passed in, to be a bit more helpful?

Anyways, just some thoughts, thanks again for the library!