GithubHelp home page GithubHelp logo

TypeScript regression about h3-js HOT 5 CLOSED

uber avatar uber commented on July 1, 2024
TypeScript regression

from h3-js.

Comments (5)

nrabinowitz avatar nrabinowitz commented on July 1, 2024

Thanks for the bug report. We probably need to add a check in Travis CI to catch this kind of issue.

from h3-js.

whaatt avatar whaatt commented on July 1, 2024

Will this be addressed in any upcoming releases? Would love to have type enforcement when using this library in TypeScript (I'm stuck on 3.4.0 at the moment).

Thanks!

from h3-js.

nrabinowitz avatar nrabinowitz commented on July 1, 2024

Yes, I'd like to fix it in the next release. I'm not as familiar with TS as I ought to be - is there a standard type-checking step we could do in CI that would catch this?

from h3-js.

whaatt avatar whaatt commented on July 1, 2024

Nothing off-the-shelf AFAIK, but it's simple enough to add a script in package.json, e.g.:

"scripts": {
  // ...
  "type-check": "tsc dist/types.d.ts"
  // ...
}

I'm guessing you do an npm install already in your CI, so you could add typescript as a dev dependency to get tsc in your local environment. If I run this command now, I get the following error output:

WorkMac:h3-js sanj$ tsc dist/types.d.ts
dist/types.d.ts:80:75 - error TS2314: Generic type 'Array<T>' requires 1 type argument(s).

80     function h3ToGeoBoundary(h3Index: H3Index, formatAsGeoJson: boolean): Array[];
                                                                             ~~~~~

dist/types.d.ts:137:36 - error TS2314: Generic type 'Array<T>' requires 1 type argument(s).

137     function polyfill(coordinates: Array[], res: number, isGeoJson: boolean): H3Index[];
                                       ~~~~~

dist/types.d.ts:149:83 - error TS2314: Generic type 'Array<T>' requires 1 type argument(s).

149     function h3SetToMultiPolygon(h3Indexes: H3Index[], formatAsGeoJson: boolean): Array[];
                                                                                      ~~~~~

dist/types.d.ts:228:93 - error TS2314: Generic type 'Array<T>' requires 1 type argument(s).

228     function getH3UnidirectionalEdgeBoundary(edgeIndex: H3Index, formatAsGeoJson: boolean): Array[];
                                                                                                ~~~~~


Found 4 errors.

from h3-js.

nrabinowitz avatar nrabinowitz commented on July 1, 2024

Thanks, this is perfect.

from h3-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.