maplibre / maplibre-gl-geocoder

Geocoding for MapLibre
ISC License
45 stars 17 forks source link

Typescript types #112

Closed HarelM closed 2 days ago

HarelM commented 6 months ago

Does this package has typescript types? Is it possible to add support for typescript?

danawoodman commented 1 week ago

Would love built-in/bundled types!

HarelM commented 1 week ago

@thaddmt do you need help with this?

thaddmt commented 1 week ago

@HarelM if anyone is willing to help contribute would love the help! I'm not too focused on this project right now unfortunately

HarelM commented 1 week ago

@danawoodman any chance for some help here? I've started to migrate to typescript, but it seems a bit too much right now, so I think an easier approach would be to convert to es5 class and generate types from it. I've done that in a typescript branch, but there's a need to make the js compatible with how it used to be before the change, it's a bit of a tooling headache, but not a big one. See #117. Feel free to open PRs against that branch.

danawoodman commented 1 week ago

what about using jsdoc types and a hard coded .d.ts file?

i'm not familiar with the code but will have a look

HarelM commented 6 days ago

A hard coded d.ts is possible, but I wanted something a bit more robust.

danawoodman commented 6 days ago

baby steps, a .d.ts plus jsdocs seems a step towards a TS rewrite imo

danawoodman commented 6 days ago

going to take a stab at this... if successful ill push up a pr

HarelM commented 6 days ago

Take a look at the branch I made, I think you can take the generated types from there, improve them a bit and check that into this repo.

HarelM commented 4 days ago

See the following PR:

Using this branch there's an easy way to generate the typescript.d.ts file. The only thing missing in that branch is the conversion of the tests to typescript and the need to fix some as any which are probably due to incorrect or old code.