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

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

Open
toolness opened this issue Aug 8, 2020 · 0 comments
Open

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

toolness opened this issue Aug 8, 2020 · 0 comments

Comments

@toolness
Copy link

toolness commented Aug 8, 2020

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!

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

1 participant